Re: Different scales on the same axis
- To: mathgroup at smc.vnet.net
- Subject: [mg122042] Re: Different scales on the same axis
- From: "David Park" <djmpark at comcast.net>
- Date: Mon, 10 Oct 2011 04:28:15 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <12270078.43173.1318144055740.JavaMail.root@m06>
With the Presentations application there is a simple solution. (I'm not certain why you went with a ListLinePlot here since you have simply defined functions. I'm going to use Draw which corresponds to Plot.) We Rescale x in f1 so that {-200,0} is mapped to {-800,0}. We then define CustomTicks for the lower x axis with the inverse scaling. These ticks will only show on the lhs of the lower horizontal edge of the frame and the rhs will be empty of ticks. We then design normal scale ticks for the upper x side and these only show on the rhs. It would be somewhat more difficult to get both scales on the lower frame and the viewer might miss the change of scale. Putting the two scales on the lower and upper sides of the frame makes it clearer that they are different scales. << Presentations` x1ticks = CustomTicks[Rescale[#, {-800, 0}, {-200, 0}] &, {-800, 0, 200, 4}]; x2ticks = CustomTicks[Identity, {0, 200, 50, 5}]; Draw2D[ {Draw[f1[Rescale[x, {-200, 0}, {-800, 0}]], {x, -200, 0}], Draw[f2[x], {x, 0, 200}]}, AspectRatio -> 1/2, Frame -> True, FrameTicks -> {{Automatic, Automatic}, {x1ticks, x2ticks}}] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Luiz Melo [mailto:lmelo at ufsj.edu.br] Hi all, I have two different functions: f1 defined in the range -800<x<0, and f2 in the range 0<x<200. The graphics of f1 and f2 in the same plot could be done, for instance, with (I'm using version 8.0.0.0): f1[x_] := Sin[x Degree]; t1 = {#, f1[#]} & /@ Range[-800, 0, 5]; f2[x_] := 2 Sin[x Degree]*Exp[-x/100]; t2 = {#, f2[#]} & /@ Range[0, 200, 5]; ListLinePlot[{t1, t2}, PlotRange -> {{-800, 200}, {-1.1, 1.1}}, PlotStyle -> Thick, Frame -> True, AspectRatio -> .5] How can I "squeeze" the x axis of the plot of f1 (-800<x<0) to have the center of the coordinates (0,0) exactly at the middle of the plot frame? Thank you. Luiz