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
  • Subject: [mg48937] RE: [mg48919] basic question about plotting 2 functions in one graph
  • From: "David Park" <djmp at>
  • Date: Thu, 24 Jun 2004 05:35:59 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


Here is a somewhat fancier version of your plot.


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

From: Ron Haus [mailto:ronhaus at]
To: mathgroup at

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?


  • 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?