ANN matplotlib-0.51

What's new in matplotlib 0.51

Tkinter backend

  Todd Miller has written a Tkinter backend. This is a significant
  step forward, because now matplotlib works out of the box with any
  python + numeric. The Tkinter backend works interactively from any
  python shell - see the interactive documentation. Also, because
  TkAgg uses the agg backend for rendering, it has all of the features
  of agg, including fast antialiased rendering, freetype2, alpha
  blending, mathtext, and so on. See To use the TkAgg
  backend, you must launch your scripts in interactive mode

    > python -i -dTkAgg

  otherwise they'll just pop up and disappear.

freetype2 support added for agg backend

  With freetype2, agg now renders fonts nicely even at very small
  raster sizes.

math text

  matplotlib now ships with the BaKoMa TeX Computer Modern fonts, and
  displays math text using TeX expressions. See screenshot and the
  mathtext documentation for usage
  information. Currently available on GTK, Agg, TkAgg and GTKAgg. If
  you build matplotlib yourself, you need to edit and set

configuration file

  A configuration file is placed in your install path
  (distutils.sysconfig.PREFIX + 'share/matplotlib'). This determines
  many of the default figure properties: the default backend, line
  properties, text properties, colors, and more. See for an example configuration
  file and details. Place this in your home dir (linux and friends),
  or edit in the install path (windows).

numarray support

  Todd Miller has provided a numerix module which allows you to
  choose between Numeric of numarray. You can set Numeric or numarray
  in your matplotlibrc file, with an environment variable, or from the
  prompt. See the numerix module for more information and numarray
  issues for a summary of
  known issues in using numarray.

data clipping off by default

  Data clipping, as opposed to viewport clipping, is turned off by
  default. You can change the default behavior in .matplotlibrc or set
  it to be true when needed as in examples/

kwargs in plot commands

  The plot commands now take kwargs that are can be used to set line
  properties (any property that has a set_* method). You can use this
  to set a line label (for auto legends), linewidth, anitialising,
  marker face color, etc. Here is an example:

    plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
    plot([1,2,3], [1,4,9], 'rs', label='line 2')
    axis([0, 4, 0, 10])

Bugfixes and minor improvements

    * GTK : fixed a subplot selection GUI bug specific to python2.2
    * GTK : fixed a text layout bug
    * ALL : Fixed a multiple column subplot layout bug
    * PS : Fixed an afm parser - thanks Dominique
    * Agg : Agg now respects antialiased=False


Well that was one juicy update!

I was just trying to figure out how to speed up the completer in (which adds a noticable lag to the prompt if len(locals())
gets to 3000 like it does for me) when I noticed this new release.

TkAgg allows me to use the default python in interactive mode, which
allows me to use rlcompleter, *and* have matplotlib plots pop up
without losing the prompt. Which is all lovely.

A couple of issues I noticed with TkAgg:

* fontTools installed one of its files (FontTools.pth I think) without
read permission for normal users, which cause import fontTools to fail

* fontTools didn't find my TTF fonts because the extensions were TTF
instead of ttf

* if I savefig('file.eps') from the TkAgg backend, the EPS file is sized
to something much bigger than A4 (but it still works fine from the GTK

* after playing around, I found that

text.fontname : sans

in .matplotlibrc is the only way to get reasonably nice sans serif both in
TkAgg and in eps files. Otherwise I get complaints from one or the other
(e.g. if I specify Arial or Helvetica).

Cheers and thanks,

* if I savefig('file.eps') from the TkAgg backend, the EPS file is sized
to something much bigger than A4 (but it still works fine from the GTK

I've just found I've had similar problems saving EPS figures from the GTK
backend of matplotlib 0.51 too.

Plus TkAgg doesn't like it if you close a plot using the window close box
(not the X in the toolbar):

[I have TkAgg as my default backend in ~/.matplotlibrc and interactive
set to True]

$ python
Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from matplotlib.matlab import *
x = arange(0.0, 3.14, 0.01)
plot(x, sin(x))

[<matplotlib.lines.Line2D instance at 0x84143b4>]

... click on window close button (not toolbar close button) ...

plot(x, sin(x))

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/site-packages/matplotlib/", line 788,
in plot
line 46, in draw_if_interactive
line 121, in show
  File "/usr/lib/python2.2/lib-tk/", line 1343, in wm_deiconify
    return'wm', 'deiconify', self._w)
TclError: can't invoke "wm" command: application has been destroyed



On Thu, 4 Mar 2004, matthew arnison wrote: