Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: basic question about plotting 2 functions in one graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48937] RE: [mg48919] basic question about plotting 2 functions in one graph
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 24 Jun 2004 05:35:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Ron,

Here is a somewhat fancier version of your plot.

Needs["Graphics`Colors`"]

Plot[{3n, 2.6n}, {n, 0, 100000},
  PlotStyle -> {{AbsoluteThickness[2], PermanentGreen}, VenetianRed},
  Epilog -> {Text[k == 3, {40000, 3*40000}, {1, -1}],
      Text[k == 2.6, {60000, 2.6*60000}, {-1, 1}]},
  Frame -> True,
  FrameLabel -> {n, k n},
  PlotLabel -> "Plot Example",
  Background -> Linen,
  ImageSize -> 500]

The Graphics`Colors` standard package allows you to use colors by name
instead of using RGBColor.

I used a lot of Plot options. When I first started with Mathematica, graphic
options seemed like a big nuisance but they are actually quite useful and
necessary for producing a nice looking plot.

PlotStyle was used to specify the colors of the two curves. As an example,
the top function was also plotted with a thicker line.

Epilog is an option that allows you to add elements to the plot after the
main curves are drawn. In this case it is used to individually label the two
curves using Text statements. Look up the Text statement in Help for details
of its operation. It is also possible to first draw the functions and then
use the cursor to click off the position for the text labels and paste them
into the Text statements.

The other options should be mostly self-explanatory but you may want to look
up all these items in Help.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/







From: Ron Haus [mailto:ronhaus at arcor.de]
To: mathgroup at smc.vnet.net

Hi,
if I write something like this
Plot[{3n, 2.6n}, {n, 0, 100000}]

how can I distinguish them? How can I plot one of them green and one of them
red (for example)? How can I write the function on the graph?

THX






  • Prev by Date: RE: Chaitin lisp.m syntax errors?
  • Next by Date: Re: XML Importing
  • Previous by thread: Re: basic question about plotting 2 functions in one graph
  • Next by thread: Chaitin lisp.m syntax errors?