how to create 2 plots?

Hello,

I need to create two plots (png files) in one go, two unrelated views of
the same dataset. There is good documentation about subplots but I
cannot locate documentation about two plots. Can someone tell me how it
is done?

Can you provide us with more information? You can create one plot, save it, and then create the second, or is there something more specific you are looking for?

···

On Mon, Aug 12, 2013 at 11:58 PM, vwf <vwf@…4426…> wrote:

Hello,

I need to create two plots (png files) in one go, two unrelated views of

the same dataset. There is good documentation about subplots but I

cannot locate documentation about two plots. Can someone tell me how it

is done?


Get 100% visibility into Java/.NET code with AppDynamics Lite!

It’s a free troubleshooting tool designed for production.

Get down to code-level detail for bottlenecks, with <2% overhead.

Download for free and get started troubleshooting in minutes.

http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Joseph Hardin, MSEE

Colorado State University

Radar and Communications Laboratory

One must do not violence to nature, nor model it in conformity to any blindly formed chimaera.
-Janos Boylai

Thank you for you reply. I tried to create one after the other but when
I did this my second plot was on top of the first one. The old plot
needs to be "flushed" before starting the second one.

This doesn't work:
import matplotlib.pyplot as plt
a=plt.plot([1, 2], [1, 2])
plt.savefig('1.png', dpi=100)
b=plt.plot([1, 2], [2,1])
plt.savefig('2.png', dpi=100)

In 2.png, a and b are on top of each other

···

On Tue, Aug 13, 2013 at 12:10:32AM -0600, Joseph Hardin wrote:

Can you provide us with more information? You can create one plot, save it,
and then create the second, or is there something more specific you are
looking for?

On Mon, Aug 12, 2013 at 11:58 PM, vwf <vwf@...4426...> wrote:

> Hello,
>
> I need to create two plots (png files) in one go, two unrelated views of
> the same dataset. There is good documentation about subplots but I
> cannot locate documentation about two plots. Can someone tell me how it
> is done?
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
Joseph Hardin, MSEE
Colorado State University
Radar and Communications Laboratory
One must do not violence to nature, nor model it in conformity to any
blindly formed chimaera.
-Janos Boylai

Call 'figure()' for each plot.

see: http://matplotlib.org/api/pyplot_api.html

matplotlib.pyplot.figure(/num=None/, /figsize=None/, /dpi=None/, /facecolor=None/, /edgecolor=None/, /frameon=True/, /FigureClass=<class 'matplotlib.figure.Figure'>/, /**kwargs/)

    Creates a new figure.

    Parameters :

    *num* : integer or string, optional, default: none

        If not provided, a new figure will be created, and a the figure
        number will be increamted. The figure objects holds this number
        in a number attribute. If num is provided, and a figure with
        this id already exists, make it active, and returns a reference
        to it. If this figure does not exists, create it and returns it.
        If num is a string, the window title will be set to this
        figure's num.

Steve.

Thank you for you reply. I tried to create one after the other but when
I did this my second plot was on top of the first one. The old plot
needs to be "flushed" before starting the second one.

This doesn't work:
import matplotlib.pyplot as plt
a=plt.plot([1, 2], [1, 2])
plt.savefig('1.png', dpi=100)

plt.close()

···

On 2013/08/12 8:35 PM, vwf wrote:

b=plt.plot([1, 2], [2,1])
plt.savefig('2.png', dpi=100)

In 2.png, a and b are on top of each other

Like this you mean?

import matplotlib.pyplot as plt
a=plt.figure()
a=plt.plot([1, 2], [1, 2])
plt.savefig('1.png', dpi=100)
a=plt.figure()
a=plt.plot([1, 2], [2,1])
plt.savefig('2.png', dpi=100)

Thank you!

···

On Tue, Aug 13, 2013 at 04:43:19PM +1000, Stephen Gibson wrote:

Call 'figure()' for each plot.