Wed, 7 Dec 2011 20:29:22 +0100
Jérôme a écrit:

> Is there a way to automatically resize the axis and nicely center the whole
> set {axes + ticklabels + labels} in the figure ?
> 
> One could use add_axes and play with the coordinates until he gets something
> nice, but it gets complicated to have it automatic as things depends on
> - the number of digits of y-axis ticklabels
> - whether or not a secundary y-axis is added on the right (using twinx)

Hi again, sorry for multi-posting.

Apparently, figure.tight_layout() does not take into account the secondary
y-axis on the right.

Is this a known limitation ? (I don't see it on the caveats paragraph [1].)

Or is this the use I make of it that is incorrect ?

Example :

--------------------------------------------------------------------------

import pylab

fig = pylab.figure()

data_1 = [0,1,2,3]
data_2 = [0,5,250,30000]

lines = []

# Primary axis
ax1 = fig.add_subplot(1,1,1)
lines.extend (ax1.plot(data_1, 'b'))

# Secondary axis
ax2 = pylab.twinx(ax1)
lines.extend (ax2.plot(data_2, 'g'))

labels = ['Data 1', 'Data 2']

fig.tight_layout()

pylab.show()


--------------------------------------------------------------------------

Thanks.

[1] http://matplotlib.sourceforge.net/users/tight_layout_guide.html

-- 
Jérôme

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to