Re: Multiple scales for Y axis of plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg31107] Re: [mg31094] Multiple scales for Y axis of plot?
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Wed, 10 Oct 2001 03:43:19 -0400 (EDT)
- References: <200110090555.BAA11609@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I guess the easiest way is to use Frame->True in order to place a second
vertical axis on your graph, not alongside to the default one, but rather on
the other extreme. Try this, for example:
In[1]:=
Plot[{Sin[x], 3*Sin[x]}, {x, 0, 2*Pi},
PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]},
Frame -> True, FrameTicks -> {Automatic,
{{-3, "-3 M"}, {-2, "-2 M"}, {-1, "-1 M"}, {1, "1 M"},
{2, "2 M"}, {3, "3 M"}}, Automatic,
{{-3, "-30 T"}, {-20, "-2 T"}, {-1, "-10 T"},
{1, "10 T"}, {2, "20 T"}, {3, "30 T"}}}]
A second, perhaps more involved, possibility requires placing a vertical
line close to the default axis (or anywhere else, for that matter) and
drawing a set of ticks on it, together with the suitable text. Example:
In[2]:=
newTicks=Table[Line[{{0.175,-3+j},{0.175,-3+j}}],{j,0,6,0.2}];
textInstr=Table[Text[ToString[10(-3+j)],{0.175,-3+j},{-1,0}],{j,0,6,1}];
In[3]:=
Plot[{Sin[x], 3*Sin[x]}, {x, 0, 2*Pi},
PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]},
Epilog -> {{RGBColor[0, 0, 1], textInstr},
{RGBColor[0, 0, 1], newTicks,
Line[{{0.175, -3}, {0.175, 3}}]}}]
Tomas Garza
Mexico City
----- Original Message -----
From: "Christopher R. Carlen" <crcarle at sandia.gov>
To: mathgroup at smc.vnet.net
Subject: [mg31107] [mg31094] Multiple scales for Y axis of plot?
> Hi:
>
> I have a typical multi-expression plot like this:
>
> Plot[ {f1, f2}, {x,a,b}, PlotStyle->{RGBColor[1,0,0], RGBColor[0,0,1]}
> ].
>
> On the Y axis, I want to have a different scale for each of the two
> functions. How can I generate another scaled Y axis adjacent to the
> default one, or in general acheive this sort of thing? I anticipate a
> lengthy process of building up all the graphics primitives, but before I
> figure all that out, I'm wondering if there is a reasonably easy way.
>
> Thanks!
>
>
> --
> ____________________________________
> Christopher R. Carlen
> Principal Laser/Optical Technologist
> Sandia National Labs CA USA
>
- References:
- Multiple scales for Y axis of plot?
- From: "Christopher R. Carlen" <crcarle@sandia.gov>
- Multiple scales for Y axis of plot?