It's interesting to read your discussion of backend switching issues. It's
something that gnuplot deals with very poorly indeed, which is what
motivated me to seek out matplotlib. I.e. in gnuplot you can freely switch
backends, but the line styles are set differently (and sometimes very
awkwardly: X resources for instance!) for each backend.
Anyway, I tried out what's in CVS. As you say, it mostly works. I had
trouble though with my (rather complicated) 2x2 subplot script. The worst
problem is that when I use the Save button to save as .ps, the output is
sized too large to fit on the page: only the lower left subplot is fully
There are various other layout problems, which I managed to reproduce in
the attached hacked version of subplot_demo.py, but unfortunately I
couldn't reproduce the problem above outside of my script.
* when saving from the GTK window into a .ps file, the lines are not
clipped by the edge of the plot area: see the top left plot in the
* xaxis and yaxis labels often land on top of adjacent subplot titles and
plot areas in savefig('blah.ps') output (I've had trouble with this in the
-dPS output too)
Also, I tried to save as file.eps, but the save dialog complained and only
accepts .ps. Presumably this is an easy fix?
On Wed, 7 Jan 2004, John Hunter wrote:
> I've made some changes to the GTK backend that enable save to a ps
> figure, either by calling
> or using a file with the ps extension from the save figure dialog.
> It's not too pretty internally but it works (more or less). Consider
> this a preliminary functional implementation with known bugs that will
> be hammered out later.
> The problem in implementing this is that the AxisText instances (axis
> and tick labels, title) are backend dependent. As Jeremy noted when
> he did the wx backend, this is different than the way other objects
> (lines, patches) are handled. With some refactoring this can be made
> more elegant.
> The other problem is that the default fonts are different between the
> backends, so you'll get a lot of warnings like "Falling back on
> default font". This is another problem we need to clear up -- ie, we
> need a set of shared fontnames between backends.
> Finally, a 'gotcha' that you need to watch out for is that text
> references in scripts will be destroyed by calling a postscript
> savefig (because of the way text instance conversions are handled).
> So if you did
> ax = subplot(111)
> labels = ax.get_xticklabels()
> set(labels, 'color', 'r')
> The color change would not take effect because the text references
> have been changed. Moral of story: do not change figure text
> properties after calling savefig for a ps figure with text instances
> obtained before the savefig call.
> Other than that it should work. Let me know. I've updated CVS but be
> forewarned: CVS mirrors sometime take a while to update.