I have a short script to plot 20 years of river flow data. I can use the plot_date command to create a plot, using this snippet: f = figure() ax1 = f.add_subplot(111) ax1.plot_date(dates0,y1,'g', label='observed', xdate=True,visible=True) ax1.plot_date(dates1,y2,'r', label='simulated', xdate=True,visible=True) years = YearLocator(1, month=6, day=30) # every year months = MonthLocator(1) # every month ax1.set_xlim(date2num(datetime.date(1990,1,1)),date2num(datetime.date(1999,12,31))) ax1.xaxis.set_major_locator(years) ax1.xaxis.set_minor_locator(months) labels = ax1.get_xticklabels() setp(labels, fontsize=8,visible=True)
The problem is with the x-axis (time axis) labels when I add a second subplot, to add the next time segment. I change the above to ax1 = f.add_subplot(211), and then: ax2 = f.add_subplot(212) ax2.plot_date(dates0,y1,'g') #plots the time series ax2.plot_date(dates1,y2,'r') #need to call twice, unlike plot, plot_date takes one set ax2.set_xlim(date2num(datetime.date(2000,1,1)),date2num(datetime.date(2009,12,31))) ax2.xaxis.set_major_locator(years) ax2.xaxis.set_minor_locator(months) setp(labels, fontsize=8,visible=True) The x-axis labels only appear for the last subplot. I'm guessing that plot_date assumes that more than one subplot must share a time axis. There must be a simple way to stop plot_date from doing this, if this is indeed the problem. Any guidance would be appreciated. Thanks, Ed ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users