Plotting Multiple Curves on Same Axes; Save as .jpg

I've looked at all the docs I can find on the matplotlib web site without
finding the answers to two questions. Pointers to references are greatly
appreciated.

   1) I want to plot a series of curves on the same set of axes. For
example, shoulder- and trapezoidal curves:

    _______ __________ _______
   > \ / \ /
   > \ / \ /
   > \ / \ /
   > \ / \ /
   > \/ \/
   > /\ /\
   > / \ / \
   > / \ / \
   > / \ / \
   >_______/________\__________/________\_______

With labels and text, of course. Each curve represents values in a separate
row of the database table.

   How do I specify that subsequent curves are to be plotted on the same axes
as the first one?

   2) When each plot is created I want to save it as a .jpg file so it can
be included in a ReportLab report. Do I specify the filename and extension
in the save() command, or is there a different way?

Rich

···

--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

   I've looked at all the docs I can find on the matplotlib web site
without finding the answers to two questions. Pointers to references are
greatly appreciated.

   1) I want to plot a series of curves on the same set of axes. For
example, shoulder- and trapezoidal curves:

    _______ __________ _______

   > \ / \ /
   > \ / \ /
   > \ / \ /
   > \ / \ /
   > \/ \/
   > /\ /\
   > / \ / \
   > / \ / \
   > / \ / \
   >_______/________\__________/________\_______

With labels and text, of course. Each curve represents values in a separate
row of the database table.

   How do I specify that subsequent curves are to be plotted on the same
axes as the first one?

you can call hold(True) so each call to plot() adds a new curve to the axes.

   2) When each plot is created I want to save it as a .jpg file so it can
be included in a ReportLab report. Do I specify the filename and extension
in the save() command, or is there a different way?

Agg does not produce jpg. Can you live with a png? png are not lossy and so
they yield much nicer line art than jpgs. Just give your filename a .png
extension and save will recognize the format.

Darren

···

On Monday 07 January 2008 03:05:30 pm Rich Shepard wrote:

you can call hold(True) so each call to plot() adds a new curve to the axes.

Darren,

   Excellent! Where is this documented, please? I did not see it when I
looked in the docs.

Agg does not produce jpg. Can you live with a png? png are not lossy and
so they yield much nicer line art than jpgs. Just give your filename a
.png extension and save will recognize the format.

   Yes, a .png image can be incorporated into a .pdf file as easily as can a
.jpg impage.

Thank you very much,

Rich

···

On Mon, 7 Jan 2008, Darren Dale wrote:

--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

See section 3.1 in the users guide:
http://matplotlib.sourceforge.net/users_guide_0.91.2svn.pdf

···

On Monday 07 January 2008 04:43:26 pm Rich Shepard wrote:

On Mon, 7 Jan 2008, Darren Dale wrote:
> you can call hold(True) so each call to plot() adds a new curve to the
> axes.

Darren,

   Excellent! Where is this documented, please? I did not see it when I
looked in the docs.

The function is document
http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-hold and the
usage in the "Simple Plots" Section 3.1 of the User's Guide at
http://matplotlib.sourceforge.net/users_guide_0.91.2svn.pdf . The
hold functionality is part of the state-machine interface inherited
from matlab, where plotting commands are targets to the current axes
in the current figure, and overbplotting is controlled by the "hold"
state. Se also, "ishold"

JDH

···

On Jan 7, 2008 1:43 PM, Rich Shepard <rshepard@...695...> wrote:

On Mon, 7 Jan 2008, Darren Dale wrote:

> you can call hold(True) so each call to plot() adds a new curve to the axes.

Darren,

   Excellent! Where is this documented, please? I did not see it when I
looked in the docs.

Thank you John and Darren.

Rich

···

On Mon, 7 Jan 2008, John Hunter wrote:

The function is document
http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-hold and the
usage in the "Simple Plots" Section 3.1 of the User's Guide at
http://matplotlib.sourceforge.net/users_guide_0.91.2svn.pdf . The hold
functionality is part of the state-machine interface inherited from
matlab, where plotting commands are targets to the current axes in the
current figure, and overbplotting is controlled by the "hold" state. Se
also, "ishold"

--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863