Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'sexond y-axis in a 2D-Plot -- How??' topicStudent Support Forum > General > "sexond y-axis in a 2D-Plot -- How??"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Forum Moderator
email me
11/16/99 05:42am

>I would like to plot 2 different functions in one Plot. Is there any possibility to add a second y-axis (with a different range) so that one of the curves is related to this additional axis?


One way is to use Show with FullGraphics, e.g.

Here are two plots:

In[70]:= gr1 = Plot[x, {x, 0, 4 }]
In[74]:= gr2 = Plot[x^2, {x, 0, 4}, AxesOrigin -> {4, 0}]

Now show them together:

In[79]:= Show[{FullGraphics[gr2], FullGraphics[gr1]}]

As far as I know, if you want to scale things so that the ''length'' of each axis is the same (to the eye), you must do that ''manually'', e.g. in the plot below I multiply the first function plotted by a scale factor and create scaled Ticks.

In[85]:= gr1 = Plot[4 x, {x, 0, 4 },
Ticks -> {Automatic, Table[{i, i/4}, {i, 0, 16, 4}]},
PlotRange -> {0, 16}]

This is the ''scaled'' pair of plots.

In[86]:= Show[{FullGraphics[gr2], FullGraphics[gr1]}, PlotRange -> All]

Tom Zeller
Forum Moderator.

URL: ,

Subject (listing for 'sexond y-axis in a 2D-Plot -- How??')
Author Date Posted
sexond y-axis in a 2D-Plot -- How?? A.Krumm 10/21/99 6:06pm
Re: sexond y-axis in a 2D-Plot -- How?? Forum Modera... 11/16/99 05:42am
< Previous CommentHelp | Reply To Comment | Reply To Topic