import numpy as np
from valjean.javert.templates import (PlotTemplate, CurveElements,
                                      SubPlotElements)
bins = [np.array(['spam', 'egg', 'bacon'])]
data = [np.array([1, 3, 4]),  np.array([2, 4, 5]),
        np.array([5, 3, 2]), np.array([2, 3, 1])]
names = ['Terry', 'John' , 'Graham', 'Eric']
lcurves = []
for datum, name in zip(data, names):
    lcurves.append(CurveElements(values=datum, bins=bins, legend=name))
speb = SubPlotElements(curves=lcurves,
                       axnames=['ingredient', 'quantity'], ptype='bar')
spebs = SubPlotElements(curves=lcurves,
                        axnames=['ingredient', 'quantity'],
                        ptype='barstack')
pltbar = PlotTemplate(subplots=[speb, spebs], small_subplots=False)
from valjean.javert import mpl
mplplt = mpl.MplPlot(pltbar)
fig, _ = mplplt.draw()
