modifying a plot from an imported module

Hello,

I am plotting something in a file A.py

In another file (B.py), I wish to do
  import A
and then add a curve to that same plot (and replot it).

Is that possible?

Thanks!

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/modifying-a-plot-from-an-imported-module-tp43533.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hi.

The short answer is yes.

orion:~ % cat A.py

from matplotlib.pyplot import *

print "A"
plot([0,1],[0,1])
draw()
orion:~ % cat B.py

from matplotlib.pyplot import *

import A

print "B"
plot([0.5,0.75],[0,1])
draw()
show()

Using ipython:

In [2]: run -i B.py
A
B

and the figure shows both plots.

M

···

On 6/16/14, 12:12 PM, felix_werner wrote:

Hello,

I am plotting something in a file A.py

In another file (B.py), I wish to do
   import A
and then add a curve to that same plot (and replot it).

Is that possible?

Thanks!

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/modifying-a-plot-from-an-imported-module-tp43533.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Perfect, many thanks!

So the trick was _not_ to do "show()" in A.py

(Moreover, doing "draw()" in A.py also seems necessary... even though I
don't really get why -- actually in my own more complicated program, it
works also without this draw...)

···

--
View this message in context: http://matplotlib.1069221.n5.nabble.com/modifying-a-plot-from-an-imported-module-tp43533p43537.html
Sent from the matplotlib - users mailing list archive at Nabble.com.