Neal Becker wrote: > Actually, though, I didn't want to plot 2 different sets of data as in that > example, I want 1 set of data plotted with 2 different x-axis (different > units). Any suggestion on modifying this example to accomplish this? > > import numpy as np > import matplotlib.pyplot as plt > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost > > fig = plt.figure(figsize=(10,8)) > host = SubplotHost(fig, 111) > fig.add_subplot(host) > parx = host.twiny() > > parx.axis["top"].set_visible(False) > offset = 0, -50 > new_axisline = parx.get_grid_helper().new_fixed_axis > parx.axis["bottom"] = new_axisline(loc="bottom", axes=parx, offset=offset) > parx.axis["bottom"].label.set_visible(True) > > hplt, = host.plot(np.random.rand(100)) > p2, = parx.plot(np.linspace(0,20,100), np.random.rand(100)*5.0, > color='green') > > plt.show() > OK, answer my own question. Just remove the line 'parx.plot(...'). I didn't realize that I'd get the second axis drawn without that plot call, but it works fine.
------------------------------------------------------------------------------ Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users