Re: Advanced plotting
- To: mathgroup at smc.vnet.net
- Subject: [mg92002] Re: Advanced plotting
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 16 Sep 2008 19:25:41 -0400 (EDT)
On 9/15/08 at 3:41 AM, kazik.lakomy at gmail.com wrote: >Hi, I am wondering is there a possibility in Mathematica 6 to use >two different scales on vertical axis- one scale on the left one and >the other on the right one (with a horizontal axis being common for >both the vertical ones). Yes, this is possible and has been answered several times before here. >The second question is is there a possibility to make >breaks in axes. What I mean is that I have a plot with let say X >domain [0,50], but I am only interested in two parts of it, say >[0,10] and [40,50], so is it possible to set a kind of an option in >Plot command? Yes, here is one way to do what you've outlined above. Plot[-1, {x, 0, 5}, PlotRange -> {0, 50}, Axes -> None, Epilog -> {Inset[ Plot[45 - 20 ( x - 2)^2 + x, {x, 0, 5}, PlotRange -> {40, 50}, Frame -> {False, True, True, True}, AspectRatio -> 1/5], Scaled at {.06, .5}, {0, 40}, 5], Inset[Plot[45 - 20 ( x - 2)^2 + x, {x, 0, 5}, PlotRange -> {0, 10}, Frame -> {True, True, False, True}, AspectRatio -> 1/5], Scaled at {.06, .1}, {0, 0}, 5]}] Note the same usage of Inset can create a second y-axis. That is modifying this somewhat your first question could be answered by replacing the Plot[-1 ... part with one function using Frame->{True,True,True,False} then using Inset to plot the other function with Frame->{False,False,False,True}. But this approach is more complex than previous suggestions for creating a second y-axis. The simplest way I can think of to create a second y-axis would be to use FrameTicks to specify a custom axis on the right side, i.e., FrameTicks->{Automatic,Automatic,None, customList}