[SciPy-dev] Extra marker in X-Y plot

eric eric at scipy.org
Fri Nov 9 10:26:37 CST 2001


Hey Magnus,


> Silly me, thanks. I completely missed the following
> format in the plotting tutorial:
> plot(x1, format_string, x2, y2, x3, y3, format_string3, .)
> (But where did y1 go?)

plot searches through its arguments for "line groups".  A line group
can be:
    y1
    x1,y1
    y1, 'format_string'
    x1,y1,'format_string'

When format strings are present in line group, the interpretation of the
line
groups is unambigous -- the format string always comes at the end of a line
group.  In cases where format strings aren't present, there are some
ambiguous
cases.  FOr example:

plt.plot(a,b)

could be interpreted as a single line with x1=a  y1=b with b vs. a type plot
or
as two lines with y1=a and y2 = b with each line plotted vs. its array
indices.
plt will always choose the x1=a  y1=b interpretation in these cases.  I
guess
you could say that line groups are greedy.  So

plt.plot(a,b,c)

will plot b vs a and c vs. its indices.

plt.plot(a,'b-',b,c)

will plot a blue line for a vs. indices and c vs b using a default color.

plt.plot(a,'b-',b,c,d,'r+')

will plot a blue line for a vs. indices and c vs b using a default color and
d vs its indices using red plus marks.

Hope that isn't too confusing.  The good news is that this approach
generally
results in the expected behavior.

see ya,
eric

>
> I'll claim it was because the example used the same x values
> for both curves, so when I looked at the image, I draw the
> conclusion that all descriptions in the tutorial used only
> one x-values for all curves in a plot...
>
> I should read better.
>
> Thanks again,
>
> Magnus
>
>
> --
> Magnus Lyckå, Thinkware AB
> Älvans väg 99, SE-907 50 UMEÅ
> tel 070-582 80 65, fax: 070-612 80 65
> http://www.thinkware.se/  mailto:magnus at thinkware.se
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-dev
>





More information about the Scipy-dev mailing list