Hello, I put a patch in the tracker that implements groups in the SVG
backend. Is that the preferred way to submit patches, or should I just
I've also been working on images. SVG has an image tag where you can
include a external .png file. I used some code from the GTK backend to
save an image as a png, then included, as shown below.
def draw_image(self, x, y, im):
Draw the Image instance into the current axes; x, y is the
upper left hand corner of the image
rows, cols, s = im.as_str()
X = fromstring(s, UInt8)
X.shape = rows, cols, 4
try: pa = pb.get_pixels_array()
except AttributeError: pa = pb.pixel_array
pa[:,:,:] = X
gc = self.new_gc()
self._draw_rawsvg('<image x=\"%f\" y=\"%f\" width=\"%f\"
height=\"%f\" xlink:href=\"test.png\"></image>' % (x, self.height-y,
The above works for 'image_demo2.py' in the examples. The downside of
this approach is that it would make the SVG backend dependent on GTK.
Can anyone think of a better way?
I was thinking of naming the png files 'filename_1.png',
'filename_2.png', etc. for each image in the figure, where
'filename.svg' is the name of the main file. What do you think?