On Tue, Nov 13, 2012 at 6:16 AM, Francesco Montesano
franz.berges...@gmail.com wrote:
Dear matplolibers,
when dealing with multi-axes plot sometimes would be nice to use
figure-wide x and y labels.
On the web I've found some suggestion on how to do this, but I found
no solution valid in the general case and that integrate in the
matplotlib ecosystem.
The ideal would be to have a set_xlabel and set_ylabel method in the
Figure class, with the same api of the corresponding Axes methods.
As a proof of concept I've written a class derived from Figure , which
implements the two methods simply adding a horizontal (vertical) text below
(left of) the lowest (leftmost) axes.
The class together with a short example is attached.
I'm aware that the current implementation is really poor (no integration
with tight_layout, the padding must be adjusted by hand, a problem in
particular for the y label).
The best is to use self.xaxis.set_label_text(xlabel, fontdict, **kwargs)
as in the Axis set_xlabel (as I gather this create a label that is rendered
in the correct position accounting for ticklabels, ticks, tight_layout,
etc). To do this one would have to create:
- a figure-wide invisible axes that encloses all the other
axes/subplots, and whose dimension has to be updated every time a new
axis/subplot is added (this should be easily done) with only the label
visible. This could also allow to use axis features, like twin axis.
- just the required axis (invisible) that hosts the labels. I think
that this approach is less demanding computationally, but I don't know how
much sense have two axis not attached to axes.
Any suggestions/hints on how to implement these methods in a better way is
very welcome.
If there is no opposition, later in the day I'll submit PR on github with
the two new method and see if we can get something out of this idea.
Cheers,
Francesco
I am not exactly sure if this is the same as what you are thinking, but the
axes objects have a label_outer() method that would turn on and off the
visibility of various axis components based on their location in a subplot
grid. You call it for each axes in a subplot grid.
Cheers!
Ben Root
--
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users