Hi,
the below code works for me but in case there are few values to be rendered
it chokes (I think this is the culprit or maybe one of the values isn't unique
in those input lists?):
pylab.clf()
if longlegends:
F.set_size_inches( (DefaultSize[0], DefaultSize[1]*2.5) )
_e = []
_ee = []
_eee = []
for _name in _unique_names:
_d = []
for _i, _name2, _position in zip(range(len(_matching[1])), _matching[1], _matching[11]):
if _name == _name2:
_d.append(_matching[11][_i])
_c = _colors_for_unique_names[_name]
_l = _name
if _d:
_e.append(_d)
_ee.append(_c)
_eee.append(_l)
if longlegends:
pylab.subplot(211)
params = {'legend.fontsize': 8}
pylab.rcParams.update(params)
pylab.hist(_e, bins=50, histtype='barstacked', align='mid', color=_ee, log=False, label=_eee)
pylab.title("some title")
pylab.xlabel("... position")
pylab.ylabel("Occurrence ... (barstacked)")
pylab.ylim(ymin=0)
pylab.xlim(xmin=0, xmax=1200)
if longlegends:
pylab.legend(loc='upper left', bbox_to_anchor = (-0.15, -0.1), ncol=2)
F.savefig(prefix + ".png", dpi=100)
else:
F.savefig(prefix + ".png", dpi=100)
F.savefig(prefix + ".png", dpi=100)
File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1172, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 2017, in print_figure
**kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py", line 103, in print_png
return agg.print_png(filename, *args, **kwargs)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 445, in print_png
FigureCanvasAgg.draw(self)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 400, in draw
self.renderer = self.get_renderer()
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 411, in get_renderer
self.renderer = RendererAgg(w, h, self.figure.dpi)
File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 59, in __init__
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
ValueError: width and height must each be below 32768
Could anybody make something out of the error message? I tried NOT to specify
bins=50 but that does not help. I have matplotlib-1.1.0. Thanks for any clues,
Martin
BTW: The ugly for loop I had to introduce because I could simply pass nested lists
with data values and color to pylab.hist().