I’m making a set of plots (a strip chart) stacked on top of each other,
all sharing the same X axis (time).
So far it appears that to get the X axis of each Subplot to match I have
to set its properties independently.
Is there some way to tie them all together so that a user can set the
properties of one and have it propagate? I’m particularly concerned
about tick marks and the X grid lines; I only want to show tick labels
on the bottom-most Subplot.
I suppose one possibility is to create some kind of object on which I
can call Subplot.xaxis methods and have it apply those changes to all
the Subplots. Has anyone done this?
Russel, maybe this example might help?
There are also some more advanced subplot layout methods available called
axis_grid1 in the mpl_toolkits.
I hope this helps!
Thank you. sharex was just what I was looking for.
I was pleasantly surprised I could hide the x axis labels on the upper
subplots using the following code:
for subplot in self.subplotArr[0:-1]:
# can't find API equivalent of pylab.setp so...
for ticklabel in subplot.get_xticklabels():
since it’s a strip chart and new X ticks are constantly being created as
time advances. Thank heavens it doesn’t show labels on the new ones.
Don’t know if it is useful for you or not, but there is also the .label_outer() function that will set the visibility of the axes tick labels based on which subplot they are in the figure.
I also tried axis_grid1 but was unable to get plots, and since the other
technique is working and more backward-compatible I’m happy to stick to
axes_grid1 can be a little tricky to figure out at first, but once you get the knack of it, it can be a powerful feature to use in the future. However, I am glad that the other method works perfectly.
On Fri, Sep 24, 2010 at 5:47 PM, Russell E. Owen <rowen@…2756…> wrote:
Benjamin Root <ben.root@…1304…> wrote:
On Fri, Sep 24, 2010 at 12:30 PM, Russell E. Owen > > > <rowen@…2756…> wrote: