Hi

I tried you suggestions but it didn't work out for me.
In the following code I try to save the axes and the grid from figure1 into
buffer and then restore it on figure2 but figure2.png turns out to be of an
empty canvas.

#!/usr/bin/env /opt/python/bin/python
# encoding: utf-8
import matplotlib
if not matplotlib.get_backend()=='agg':
    matplotlib.use('Agg')
import pylab

figure1 = pylab.figure(1)
axes1 = pylab.gca()
axes1.grid()
canvas1 = axes1.figure.canvas
background = canvas1.copy_from_bbox(axes1.bbox)
figure1.savefig('figure1.png')

figure2 = pylab.figure(2)
canvas2 = figure2.canvas
canvas2.restore_region(background)
figure2.savefig('figure2.png')

Thanks for your efforts,
Hrafnkell
-- 
View this message in context: 
http://www.nabble.com/Save-a-plot-background-tp20519596p20539991.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to