Re: switching axes in Plot?
- To: mathgroup at smc.vnet.net
- Subject: [mg96360] Re: switching axes in Plot?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 12 Feb 2009 06:37:02 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <gmu8qa$glt$1@smc.vnet.net>
In article <gmu8qa$glt$1 at smc.vnet.net>, <John.Finnigan at csiro.au> wrote:
> When using Plot to plot F[x] as a function of x, Mathematica automatically =
> assigns the independent variable x to the horizontal axis and the dependent=
> variable F[x] to the horizontal. I often want to switch this around so th=
> at the independent variable runs on the vertical axis and the dependent on =
> the horizontal. I feel sure there ought to be a simple way to tell Plot to=
> make this change but I have never found it and instead have resorted to co=
> nvoluted approaches. Can anyone tell me what the simple trick is, if it ex=
> ists?
One of the most straightforward and less error prone way of switching
the x- and y-axis must be by using ParametricPlot as illustrated below.
f[x_] = x^2 Sin[x];
Plot[f[x], {x, -Pi, 2 Pi}]
ParametricPlot[{f[x], x}, {x, -Pi, 2 Pi}]
Regards,
--Jean-Marc