John Harrison wrote:
> bump.  please...?
> 
> Begin forwarded message:
>>
>> I have some code that produces a series of graphs of data over time.  
>> For the most part it works well, but for certain combinations of dates 
>> the two plots do not line up, due to the width of the bars in the 
>> first subplot.  What is the best way for force my second subplot's x 
>> axis to be identical to that of the first subplot?

Check the sharex kwarg.  In the examples directory, see ganged_plots.py, 
shared_axis_demo.py, and any others that include the sharex kwarg.

Eric


>>
>> Thanks!
>>
>> Here is minimal code reproducing the problem:
>>
>> import matplotlib
>> from datetime import *
>> import time
>> from pylab import *
>>
>>
>> def toOrd(strDate):
>> return datetime(*time.strptime(strDate,"%m/%d/%y")[0:5]).toordinal()
>>
>> def main():
>>
>>
>> startDate = toOrd("05/24/05")
>> endDate = toOrd("11/21/06")
>>
>>
>> dates = range(startDate,endDate,7)
>> figure(1)
>>
>>
>> axis = subplot(211,axisbelow=True)
>> plot_date(dates,dates,visible = False)
>> axis.bar(dates,dates, width=3.0)
>>
>>
>> axis = subplot(212,axisbelow=True)
>> plot_date(dates,dates) #,'-',color = priceColor)
>>
>>
>> show()
>>
>>
>>
>> if __name__ == '__main__':
>> main()
>>
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to