On 7/11/06, Gary Ruben <[EMAIL PROTECTED]> wrote:
> On this topic, here is something I used the other day (just some
> different dash sequences):
>
> e, = plot(x, y, 'k', label=r'$\theta_3=%1.2f$'%(th3))
> setp(e, dashes={0:(1,0), 1:(2,2), 2:(10,4), 3:(10,4,4,4), 4:(10,2,2,2),
> 5:(15,2,6,2)}[i])

Thanks for these.  In playing with this, both for my needs and to try
and contribute something for a permanent solution, I found something
really strange.  Try running the following code in pylab:

"""Simple dashing test."""

import numpy as N
import pylab as P

dashes= { 0:(1,0),
          1:(2,2),
          2:(10,4),
          3:(10,4,4,4),
          4:(10,2,2,2),
          5:(15,2,6,2) }

y = N.ones(10)+N.rand(10)

P.figure()

dashnums = dashes.keys()
dashnums.sort()
for d in dashnums:
    P.plot(y,dashes=dashes[d])
    # Bug??? Using this, nothing gets displayed:
    y += 1
    # But with this, it works fine:
    #y = y+1

P.show()
# EOF


Uncomment the 'y=y+1' option, and all works fine.  Here's where the
problem may be coming from, just try this in a terminal:

y = 1.0*arange(10)
plot(y)
y += rand(10)
show()

There are actually two issues here, one is definitely a bug, the other
one could be construed as a feature (albeit a surprising one):

- bug: that the script above doesn't display anything with current
SVN.  I don't know why.

- feature?: that mpl holds on to the actual numpy memory buffer, so if
an array is modified in-place, any subsequent window update will
modify the plot.  I can actually see this being quite useful for
monitoring a region of memory, though it can cause surprising behavior
if you are just trying to get successive plots.  I guess I'm squarely
+1/-1 on how much I like it :)

I'll work a bit more on the dashing and send something later...

Cheers, and thanks for the hints!

f


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to