On Mar 9, 2012, at 1:05 PM, Jonathan Slavin wrote:

> Hi all,
>
> I'm plotting a set of subplots (2 x 3) and I'd like to label the x  
> and y
> axes with one title each (i.e. spanning the axes) since the units  
> of all
> the x axes and y axes are the same.  I know that I can use fig.text to
> do it, though that would require some fiddling on my part to get the
> placement right.  Is there an easier way?
>
> Jon

Hi Jon,

The way I do this is to create a "master" axis that overlaps the  
others with dimensions equal to the outer border of all the other  
axes. Then I just use this axis for the labels:
masterAxis.set_xlabel("ick")
masterAxis.set_ylabel("blech")

You also have to turn off ticks and tick labels for this axis:
masterAxis.xaxis.set_major_formatter(mpl.ticker.NullFormatter())
masterAxis.yaxis.set_major_formatter(mpl.ticker.NullFormatter())

Since it doesn't know about tick labels, it may not position the axis  
labels far enough away from the axis line, so you can adjust the  
spacing:
masterAxis.xaxis.labelpad += 6
masterAxis.yaxis.labelpad += 4

It's still a little fiddly, but less fiddly than using fig.text. I  
bet this could be significantly improved, e.g. with Axes_Grid, but I  
don't know how to do that.

Cheers,
Jeff



------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to