I try to take artists from one subplot instance and add them to
another:

-------------------------
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.patches import Patch, Rectangle
from matplotlib.lines import Line2D

fig = Figure()
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.add_patch(Rectangle((.5, 1.5), 1, .2))
fig2 = Figure()
canvas2 = FigureCanvas(fig2)
ax2 = fig2.add_subplot(111)
for artist in ax.get_child_artists():
    if isinstance(artist, Line2D):
        ax2.add_line(artist)
    elif isinstance(artist, Patch):
        ax2.add_patch(artist)

ax2.add_patch(Rectangle((1.5, 2.5), 1, .2, facecolor='r'))
ax2.set_aspect("equal")
ax2.autoscale_view()
w, h = fig2.get_size_inches()
xmin, xmax = ax2.get_xlim()
ymin, ymax = ax2.get_ylim()
xext = xmax - xmin
yext = ymax - ymin
if xext < yext:
    w = h * xext/yext
else:
    h = w * yext/xext
    
size = fig2.set_size_inches(w, h)
canvas2.print_figure('copy2.eps')
-------------------------

But this fails to plot the first rectange in the resulting plot. The
second, red rectangle is painted correctly in the resulting plot, but
the first one is totaly missing in the plot, leaving only a line in
the plot. Is there some kind of internal status that has to be
resettet in the actors?

Kind regards
Berthold
-- 
[EMAIL PROTECTED] / <http://höllmanns.de/>
[EMAIL PROTECTED]                 / <http://starship.python.net/crew/bhoel/>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to