Ah, this seems to be the issue that my figsize was growing all the time so it
went over the maximum limits.

I thought this is valid:
DefaultSize = F.get_size_inches()
print str(DefaultSize)
blah
F.set_size_inches(DefaultSize)

See http://matplotlib.sourceforge.net/api/figure_api.html

<quote>
set_size_inches(*args, **kwargs)

    set_size_inches(w,h, forward=False)

    Set the figure size in inches

    Usage:

    fig.set_size_inches(w,h)  # OR
    fig.set_size_inches((w,h) )

    optional kwarg forward=True will cause the canvas size to be automatically 
updated; eg you can resize the figure window from the shell

    ACCEPTS: a w,h tuple with w,h in inches
</quote>

Nope, it does not work. The print call gives me: [ 8.  6.]. So, this is not a 
tuple?
Or python-2.7 issue how is it printed ... I fear? ;-)
Anyway, doing

F.set_size_inches(11.2, 15)

works for me.

Martin



Martin Mokrejs wrote:
> 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().
> 
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to