Hi, I’ve been using matplotlib for about a week now
and am exceedingly confused by all the class hierarchies and stuff.
I’m trying to draw an arc and some other polygons and
render them to either GTK or postscript. I’m running Python 2.4 with
Idle and XP
I can successfully do the following:
Using the matlab-ish commands, I can create a
figure, polygons, circles, and use add_patch() to add these shapes to the
I can direct it to GTK or PS with the matplotlib.use
command. I can print out the resulting PS file just fine, and the plot
shows up on the screen with GTK just fine.
The problem is I want to draw arcs. I don’t see
an Arc() command at the same level as Polygon and Circle. The only place
I see an arc is with the renderer classes.
I tried extracting the current renderer from the figure and
axis (via the _cachedRenderer attribute), but those don’t seem to be
assigned until I do a savefig() or a show(), but obviously I want the renderer before
any show()ing or savefig()ing.
So then I tried creating a RendererPS class directly
(instead of RendererAgg as in the User’s Guide). It seems to want a
pswriter argument. I looked around and saw that pswriter is expected to
be some type of cString.StringIO or something, which seemed too low-level, and
I figured I didn’t want to mess around any more. I just want to
draw a stupid arc.
Also, if I have a GTK figure, and then do show(), it plots a
nice figure on the screen. If I then close it, type show() again, my
python window freezes up and I have to kill it with the process manager.
If anyone can shed some light on these problems I’d be
much happier J