|
From: Neal B. <ndb...@gm...> - 2011-09-12 11:08:36
|
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() |