[Date Index]
[Thread Index]
[Author Index]
Re: Axis in two scales
*To*: mathgroup at smc.vnet.net
*Subject*: [mg92589] Re: Axis in two scales
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Tue, 7 Oct 2008 07:05:03 -0400 (EDT)
On 10/6/08 at 4:13 AM, ncc1701zzz at gmail.com (Nacho) wrote:
>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?
There are a number of ways that should achieve something
suitable. Based on my interpretation of what you are asking for,
I suggest the following:
func = Piecewise[{{Sin[100 x], x < .5}, {Sin[x], x >= .5}}];
GraphicsRow[{Plot[func, {x, 0, .5},
Frame -> {True, True, False, False}, Axes -> None],
Plot[func, {x, .5, 5}, Frame -> {True, False, False, False},
Axes -> None]}, Spacings -> 0]
I've used Piecewise rather than creating a list of data points
to apply since that allows me to take advantage of Mathematica's
adaptive sampling algorithm. I see no point to explicitly
computing values and using ListPlot if the only purpose is to
produce a graphic.
Literally, have created two separate plots and use GraphicsRow
to combine them in an appropriate fashion to make a single
graphic. The net effect is a single graphic with a break in the x-axis.
This particular approach does introduce one aspect in the final
graphic that could be seen as misleading. As the function is
defined, there start of the graph on the right hand side should
appear directly above the end of the graph on the left hand side
rather than being displaced along the horizontal axis.
But given the scaling changes, it isn't clear to me making the
start of the right graphic align vertically with the end of the
left graphic is any less misleading.
Prev by Date:
**Re: Print A Math Formula In Formatted Notebook**
Next by Date:
**Re: Real and Complex Roots presented in a single plot**
Previous by thread:
**Re: Axis in two scales**
Next by thread:
**Re: Axis in two scales**
| |