Hi everybody,

I want to modify a matplotlib.lines.Line2D and update the plot.
I have used Line2D._y member to modify the line. It works. But by doing
canvas.draw() (see example below), the line is not updated on the plot. To
update it, I have to do autoscale_view(). But I do not want the x and y
ranges of the plot to be changed.

How to do this?

Thanks in advance,

Julien

###################
from pylab import *
import matplotlib

ion()
f = figure()
s = f.add_subplot("111")

X1 = arange( 0.0, 5.0, 0.1 )
# print X1, X1**2
line = matplotlib.lines.Line2D( X1, X1**2 )


s.add_line( line )

draw()

raw_input("\npress a key to transform y in y+10")
line._y += 10

raw_input("\npress a key to do canvas.draw()")
s.figure.canvas.draw()
draw()
print "The line y has not been updated in y+10"

raw_input("\npress a key to do relim, autoscale and canvas.draw()")
s.relim()
s.autoscale_view()
s.figure.canvas.draw()
draw()
print "The line y has been updated in y+10"
print "But the subplot x and y range has changed"
print "I want the line to be updated without changing x and y ranges"

raw_input("\npress a key to quit")
#################

-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to