From: Paul Barrett <barrett@st...> - 2004-02-10 19:34:44
I occasionally use the scatter() function to make light curves of
astronomical targets. The scale of the x-axis is often given in days
with a range of 0.54 - 0.68 days. The y-axis is in counts. This type
of data produces unusual scatter plots with the blue symbols being very
elongated ovals (in the x-direction).
Are there plans to change this behavior - maybe by drawing the symbols
in device space instead of data or user space?
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
From: John Hunter <jdhunter@ac...> - 2004-02-10 19:52:19
>>>>> "Paul" == Paul Barrett <barrett@...> writes:
Paul> I occasionally use the scatter() function to make light
Paul> curves of astronomical targets. The scale of the x-axis is
Paul> often given in days with a range of 0.54 - 0.68 days. The
Paul> y-axis is in counts. This type of data produces unusual
Paul> scatter plots with the blue symbols being very elongated
Paul> ovals (in the x-direction).
Paul> Are there plans to change this behavior - maybe by drawing
Paul> the symbols in device space instead of data or user space?
There are a couple of ways to do this.
The line style provides markers, the sizes of which are in points. If
you want fixed size markers independent of data coords, you can use
plot with the 'o' marker symbol (or any other marker symbol), and then
set the marker size, facecolor, and edgecolor, as you desire
markers = plot(x, y, 'o')
set(markers, 'markersize', 20)
set(markers, 'markeredgecolor', 'k')
set(markers, 'markerfacecolor', 'b')
The set function takes a sequence of markers and applies the arguments
to all of them. To control the marker properties separately, you can
do (for example)
rgbs = [ ... ] # a len x list of rgb tuples
sizes = [ ... ] # a len x list of marker sizes in points
for m, rgb, size in zip(markers, rgbs, sizes):
See the documentation for matplotlib.lines for more info.
Patches (which is what scatter and hist create) on the other hand, are
in data coordinates by default. This too can be changed by setting
the transformation functions. You can, for example, specify the
patches in relative (0, 1) axes coords with a little extra work. All
the figure "Artists" can be placed with arbitrary transforms -- see
matplotlib.transforms for more info. Many of these features could use
some better documentation....
My guess is that you will be happy with the line markers -- let me
From: matthew arnison <maffew@ca...> - 2004-02-11 03:40:06
You might know that octave is a free software clone of matlab. I used it
heavily for a previous project. One thing I liked about it's plot command
is an extension to the fmt string which allowed you to specify the legend
title for each line between semicolons. Like this:
plot(x, sin(x), 'r;sine;')
plot(x, cos(x), 'g;cosine;')
plot(x, tan(x), 'b;tangent;')
It seems like a handy way to be able to do things.
I couldn't see this mentioned in the matplotlib docs, and when I tried it
I got a dialog "Unrecognized character in format string". May I suggest it
as a useful addition to matplotlib? It seems like legend() might need
adjustment to allow for it too.
BTW, using the GTK backend the "Unrecognized character in format string"
dialog has locked up my python session after I clicked OK. It appeared
straight after the plot command -- not when I ran show(). After I clicked
OK, the window stayed visible but unresponsive to the close button etc.