Differences in appearance between FigureCanvasAgg and FigureCanvasWxAgg

FigureCanvasAgg seems to make fonts appear much larger that

    > FigureCanvasWxAgg. I am trying to get plots generated
    > interactively in a wx window to appear the same as those that
    > I generate in a no display batch script that outputs .png
    > files. I use FigureCanvasWxAgg for the former and
    > FigureCanvasAgg for the latter. Is there a reason why the
    > same font size would appear much larger in FigureCanvasAgg
    > than FigureCanvasWxAgg. Is there another, better, way to
    > achieve uniformity accross png outputs and wx on screen
    > display?

    > It doesn't look like one can use the FigureCanvasAgg for wx
    > embedding or the FigureCanvasWxAgg for png generation because
    > the former will not accept a parent window and the latter
    > requires one.

    > If anyone has any ideas I would greatly appreciate
    > suggestions.

backend_agg and backend_wxagg both use the same underlying pixel
buffer, so you should be able to get uniformity between them. Note,
matplotlib has a different default dpi setting for figures for display
and saving, and you might want to try forcing them to be the same with

dpi = 72
fig = figure(dpi=dpi)
plot something
fig.savefig(somefile, dpi=dpi)

If that doesn't help, the only other possibility is that the
PIXELS_PER_INCH defaults are getting you screwed up. This was
included for display devices which have a different number of pixels
per inch; see
http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5
for some info about screen dpi. I vaguely recall that there was some
good reason for including the pixels_per_inch constant *and* dpi, but
now I suspect the system may be overdetermined and we should drop this
and just use the dpi setting. In any case, each backend defines their
own (see src/_backend_wxagg.cpp and backends/backend_wx.py) and the
defaults are different in backend_agg and backend_wx).

If the dpi suggestion above doesn't work, try setting PIXELS_PER_INCH
in backend_wx.py to 72.

JDH

Thank you John. I will try as you suggest. I really appreciate your help.

--Tom

···

On 6/10/06, John Hunter <jdhunter@...8...> wrote:

   > FigureCanvasAgg seems to make fonts appear much larger that
   > FigureCanvasWxAgg. I am trying to get plots generated
   > interactively in a wx window to appear the same as those that
   > I generate in a no display batch script that outputs .png
   > files. I use FigureCanvasWxAgg for the former and
   > FigureCanvasAgg for the latter. Is there a reason why the
   > same font size would appear much larger in FigureCanvasAgg
   > than FigureCanvasWxAgg. Is there another, better, way to
   > achieve uniformity accross png outputs and wx on screen
   > display?

   > It doesn't look like one can use the FigureCanvasAgg for wx
   > embedding or the FigureCanvasWxAgg for png generation because
   > the former will not accept a parent window and the latter
   > requires one.

   > If anyone has any ideas I would greatly appreciate
   > suggestions.

backend_agg and backend_wxagg both use the same underlying pixel
buffer, so you should be able to get uniformity between them. Note,
matplotlib has a different default dpi setting for figures for display
and saving, and you might want to try forcing them to be the same with

dpi = 72
fig = figure(dpi=dpi)
plot something
fig.savefig(somefile, dpi=dpi)

If that doesn't help, the only other possibility is that the
PIXELS_PER_INCH defaults are getting you screwed up. This was
included for display devices which have a different number of pixels
per inch; see
http://groups.google.com/groups?q=screen+dpi+x11&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=7077.26e81ad5%40swift.cs.tcd.ie&rnum=5
for some info about screen dpi. I vaguely recall that there was some
good reason for including the pixels_per_inch constant *and* dpi, but
now I suspect the system may be overdetermined and we should drop this
and just use the dpi setting. In any case, each backend defines their
own (see src/_backend_wxagg.cpp and backends/backend_wx.py) and the
defaults are different in backend_agg and backend_wx).

If the dpi suggestion above doesn't work, try setting PIXELS_PER_INCH
in backend_wx.py to 72.

JDH