I'm trying to draw the axes from one figure directly over the axes for another figure, in a sense, combining the two axes as two layers on one figure.
So, first I get an axes instance, "ax". import matplotlib.pyplot as plt fig=plt.figure() fig.add_subplot(111) plt.plot(range(10), [i^2 for i in range(10)]) ax=fig.axes[0] plt.savefig('test.png') Okay, now I have the axes "ax". I want to draw ax directly on top of the following figure, and get a result that would be the same as if I had called the plot command above directly in the following code. All I'm passed in my real code is the newax variable below, which is why I use newax.get_figure()). fig=plt.figure() newax=fig.add_subplot(111) ax.set_figure(newax.get_figure()) newax.get_figure().add_axes(ax,label="newax") plt.savefig('test2.png') However, the result of test2.png is not very pretty and definitely not what I want. The tick labels for the y-axis are all scrunched up, for example. Can anyone help? For those curious, what I'm doing is working on getting the Sage graphics code to be able to wrap and intelligently display matplotlib axes objects, so that a person could easily create a matplotlib axes, wrap it in the Sage graphics class, and then be able to manipulate it in Sage. In order for this to work, it seems like I need to save the axes object I care about, and then when Sage composes it's final figure (using matplotlib), it passes me an AxesSubplot object. I need to somehow take that subplot object and draw my saved axes on it in the most intelligent way possible. In the code above, I try taking the given AxesSubplot object, getting the figure from that, and then just adding my saved axes to that figure. Is there a better way to do this? Thanks, Jason -- Jason Grout ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users