Works like a charm. :-)

Thank you so much, Damon.

Jianbao

On Fri, Oct 5, 2012 at 10:53 AM, Damon McDougall
<damon.mcdoug...@gmail.com>wrote:

> On Fri, Oct 5, 2012 at 5:44 PM, Jianbao Tao <jianbao....@gmail.com> wrote:
> > Hi,
> >
> > I am working on a time-series data browser based on matplotlib. In
> general,
> > it shows a N_row x 1_col stack of axes, which share the x axis, the time
> > axis. It is nice that matplotlib offers the sharex option so that the
> data
> > can be zoomed simultaneously in time. However, one problem with the
> sharex
> > option is that it not only shares the axis range (or limits, if you
> will),
> > but also the axis appearance, which is not always desirable. In my case,
> I
> > want the tick labels to be shown only on the bottom subplot. However,
> that
> > doesn't seem to be achievable with sharex.
> >
> > The follow snippet demonstrates my example:
> > #------------------------- code
> --------------------------------------------
> > import matplotlib.pyplot as plt
> > fig = plt.figure()
> > ax1 = fig.add_subplot(211)
> > ax2 = fig.add_subplot(212, sharex=ax1)
> >
> > ax1.get_xaxis().set_ticklabels([]) # This also suppresses x tick labels
> of
> > ax2.
> > fig.canvas.draw()
> > #-------------------------- end of code
> ------------------------------------
> >
> > Is there a workaround, hopefully simple and straightforward, to share
> range
> > (or limits) only among axes? Better yet, can this feature be added, like
> a
> > keyword sharexrange, in the future, if it is not already there? Of
> course,
> > the situation should be similar for y axis, too.
> >
> > Thank you very much.
> >
> > Jianbao
>
> This was the first hit in a google search:
>
> http://stackoverflow.com/questions/4209467/matplotlib-share-x-axis-but-dont-show-x-axis-tick-labels-for-both-just-one
>
> --
> Damon McDougall
> http://www.damon-is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
>
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to