On 02/08/2012 02:22 PM, John Hunter wrote:
> 
> 
> On Wed, Feb 8, 2012 at 1:12 PM, Ted To <rainexpec...@theo.to
> <mailto:rainexpec...@theo.to>> wrote:
> 
>     Is it possible to force the date ticks to be the same in two different
>     plots?  For example, the attached figures cover the same time spans but
>     in one, the data are weekly and the other, monthly.  While there is
>     nothing really wrong with different tick marks, aesthetically it would
>     be nice if they were both the same.
> 
> 
> 
> Yes, just use the "sharex" keyword to share the x-axis between the two.
>  Not only will they have the same ticks and labels, but when you pan and
> zoom in one the other moves with it.  The example below does not use
> dates, but it will work with dates just the same.
> 
> 
>     import matplotlib.pyplot as plt
>     import numpy as np
> 
>     fig1 = plt.figure(1)
>     ax1 = fig1.add_subplot(111)
>     ax1.plot(np.random.randn(10,2)*10)
> 
>     fig2 = plt.figure(2)
>     ax2 = fig2.add_subplot(111, sharex=ax1)
>     ax2.plot(np.random.randn(10,2)*10)
> 
>     plt.show()
> 
> JDH

Thanks again, worked like a charm!

Cheers,
Ted

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to