Discussion:
[spyder] How to plot data from different runs on one plot
Ling
2017-02-09 22:26:27 UTC
Permalink
Hi all,

What I meant by the title is that I have two different programs and I want
to plot data on one figure. In Matlab there is this definition for figure
handle which eventually points to a specific plot. Let's say if I call
figure(1) the first time, I get a figure named ''1'' created. The second I
call figure(1), instead of creating a new one, Matlab simply just plot on
the previous figure named ''1''. I wondered how I can go about and do that
in Spyder.

I am using Matplotlib in sypder. I would imagine this could be easily
achieved. But I simply don't know much about this package to figure my
problem out. :(

Any suggestions are appreciated!
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
Ronan Paixão
2017-02-10 01:14:06 UTC
Permalink
Do you really mean a separate program or do you mean two different scripts?
For the latter, the easiest way is to configure the script (F6) to "Execute
in current Python or IPython console". Then you can use something like:

from matplotlib import pyplot
pyplot.ion() # Enable interactive mode
pyplot.figure(1)
pyplot.plot([0,2,1])
pyplot.figure(2) # Open second figure, for testing
pyplot.plot([0,2,1])
pyplot.figure(1) # Go back to the first figure
pyplot.plot([1,0,2]) # This plots in first figure
Hi all,
What I meant by the title is that I have two different programs and I want
to plot data on one figure. In Matlab there is this definition for figure
handle which eventually points to a specific plot. Let's say if I call
figure(1) the first time, I get a figure named ''1'' created. The second I
call figure(1), instead of creating a new one, Matlab simply just plot on
the previous figure named ''1''. I wondered how I can go about and do that
in Spyder.
I am using Matplotlib in sypder. I would imagine this could be easily
achieved. But I simply don't know much about this package to figure my
problem out. :(
Any suggestions are appreciated!
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
Loading...