Message Boards Message Boards

0
|
2137 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Combining Line plots

Posted 10 years ago

In Mathematica, is it possible to draw 2 or more line plots on the same graph and if so, how is it done?

4 Replies

You can combine your two plots by assigning them to variables, p1 and p2 and then using Show[p1,p2]

POSTED BY: Frank Kampas

OK, I will try that. Thanks for the help.

Give a list of function to be plotted. For example:

Plot[{Sin[x], Cos[x]}, {x, 0, 2 \[Pi]}]
POSTED BY: Frank Kampas

Here are two that I want to plot on the same set of axes.

1:

PopValue = {273.8, 126.8, 178.1, 201.9, 151.4, 159.0, 183.5, 126.5, 145.2, 85.0, 164.3, 328.1, 155.7, 127.4, 194.2, 161.2, 129.0, 112.8, 137.9, 147.0, 113.2, 157.5, 135.7, 134.2};

ListPlot[PopValue, Joined -> True, AxesLabel -> {"Year", "Birds"}, AxesOrigin -> {0, 0}]

#2:

nMax = 23; p0 = 273.8;

pOneSim = Table[0, {n, 0, nMax}]; pOneSim[[1]] = p0;

Do[pOneSim[[n]] = RandomReal[NormalDistribution[0.59, 0.12]]*pOneSim[[n - 1]] + RandomReal[NormalDistribution[63.6, 52.4]], {n, 2, nMax + 1}];

pPoints = Table[{n - 1, pOneSim[[n]]}, {n, 1, nMax + 1}];

ListPlot[pPoints, Joined -> True, AxesLabel -> {"Years", "Birds"}]

Thank you.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract