Re: Axis in two scales
- To: mathgroup at smc.vnet.net
- Subject: [mg92585] Re: Axis in two scales
- From: Ray Koopman <koopman at sfu.ca>
- Date: Tue, 7 Oct 2008 07:04:16 -0400 (EDT)
- References: <gcchas$s1q$1@smc.vnet.net>
On Oct 6, 1:13 am, Nacho <ncc1701... at gmail.com> wrote: > Hello everyone. > > I have a dataset in pairs (x,y) that I would like to plot. The main > problem is that the data set has interesting parts in the beginning > that I would like to view clearly. > > As an example, create the following table: > > t = Table[{x, If[x < .5, Sin[100*x], Sin[x]]}, {x, 0, 5, 0.001}]; > ListPlot[t] > > You have a very detailed sine in the beginnng and the rest is less > interesting. > > I would like to "split" the X axis in two, so the left half of the > plot covers x={0,0.5} and the second half x={0.5,5}] in the same plot > and with the right ticks. > > It is like a piecewise axis... is it possible? > > Thanks. Transform the x-scale. For instance, define W[x_] := If[x < .5, x, .5 + (x-.5)/9] then plot using ListPlot[{W@#[[1]],#[[2]]}&/@t, Ticks->{{W@#,#}&/@{.25,.5,2,3,4,5},Automatic}] For more general situations, consider "nicer" functions such as With[{c = 9}, ListPlot[{ArcSinh[c*#[[1]]],#[[2]]}&/@t, Ticks->{{ArcSinh[c*#],#}&/@{.1,.2,.5,1,2,3,4,5},Automatic}]] with the parameter (in this case, c) and the list of tick values adjusted to taste.