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?
Thanks
John Finnigan
|
|
0
|
|
|
|
Reply
|
John.Finnigan (1)
|
2/11/2009 10:20:58 AM |
|
Hi John,
the cheapest solution is simply to rotate the picture:
Rotate[Plot[Sin[x], {x, 0, 10}], Pi/2]
However, that is probably not good enough as the labels face the wrong
way. A better way is to use ParametricPlot:
ParametricPlot[{Sin[x], x}, {x, 0, 10}]
hope this helps, Daniel
John.Finnigan@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?
> Thanks
> John Finnigan
>
>
|
|
0
|
|
|
|
Reply
|
dh1 (452)
|
2/12/2009 11:33:18 AM
|
|
Hi,
Show[Plot[{Cos[x], Sin[x], Sin[x]/x}, {x, 0, 8 Pi}] /.
Line[pnts_] :> Line[Reverse /@ pnts], PlotRange -> All]
Regards
Jens
John.Finnigan@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?
> Thanks
> John Finnigan
>
>
|
|
0
|
|
|
|
Reply
|
kuska (2791)
|
2/12/2009 11:36:09 AM
|
|
In article <gmu8qa$glt$1@smc.vnet.net>, <John.Finnigan@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
|
|
0
|
|
|
|
Reply
|
jeanmarc.gulliet (2157)
|
2/12/2009 11:36:52 AM
|
|
John, try this simple way:
f[x_] := Sin[2 x];
ParametricPlot[{f[x], x}, {x, 0, 2}]
try also this one:
ListLinePlot[Table[{Sin[2 x], x}, {x, 0, 2, 0.01}]]
Have success, Alexei
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?
Thanks
John Finnigan
--
Alexei Boulbitch, Dr., Habil.
Senior Scientist
IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg
Phone: +352 2454 2566
Fax: +352 2454 3566
Website: www.iee.lu
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.
|
|
0
|
|
|
|
Reply
|
Alexei.Boulbitch (378)
|
2/12/2009 11:42:36 AM
|
|
ParametricPlot[{Sin[x], x}, {x, 0, 4 Pi},
AspectRatio -> 1/GoldenRatio]
ParametricPlot[{Tan[x], x}, {x, 0, 2 Pi},
AspectRatio -> 1/GoldenRatio,
Exclusions -> {Pi/2, 3 Pi/2}]
Bob Hanlon
---- John.Finnigan@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?
Thanks
John Finnigan
|
|
0
|
|
|
|
Reply
|
hanlonr (2281)
|
2/13/2009 8:38:59 AM
|
|
On Wednesday, February 11, 2009 5:20:58 AM UTC-5, (unknown) 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 that 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 convoluted approaches. Can anyone tell me what the simple trick is, if it exists?
> Thanks
> John Finnigan
Hi,
I just found this looking for the answer myself. Then it hit me: try changing the order that you define the variables within the plot operation.
So as an example, given:
ContourPlot[
Evaluate[Re[
Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {x, -3,
3}, {y, -3, 3}]
To swap axes, just define y and then x -- like this:
ContourPlot[
Evaluate[Re[
Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {y, -3,
3}, {x, -3, 3}]
|
|
0
|
|
|
|
Reply
|
windlessaegis (1)
|
7/19/2012 7:52:07 AM
|
|
ParametricPlot is also useful
f[x_] = x^2 - 5 x + 6;
Plot[f[x], {x, 1, 4}]
ParametricPlot[{f[x], x}, {x, 1, 4}]
Bob Hanlon
On Thu, Jul 19, 2012 at 3:51 AM, <windlessaegis@gmail.com> wrote:
> On Wednesday, February 11, 2009 5:20:58 AM UTC-5, (unknown) 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 that the independent variable runs on the vertical axis and the dependenton 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 convoluted approaches. Can anyone tell me what the simple trick is, if it exists?
>> Thanks
>> John Finnigan
>
> Hi,
>
> I just found this looking for the answer myself. Then it hit me: try changing the order that you define the variables within the plot operation.
>
> So as an example, given:
>
> ContourPlot[
> Evaluate[Re[
> Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {x, -3,
> 3}, {y, -3, 3}]
>
> To swap axes, just define y and then x -- like this:
>
> ContourPlot[
> Evaluate[Re[
> Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {y, -3,
> 3}, {x, -3, 3}]
>
|
|
0
|
|
|
|
Reply
|
hanlonr357 (740)
|
7/20/2012 7:58:44 AM
|
|
|
7 Replies
39 Views
(page loaded in 0.343 seconds)
Similiar Articles: Multiple line plots, two y axes - comp.soft-sys.matlabPeople using Excel for 30 years are not going to switch and its been my mission to ... 3 y axis plot graph - comp.soft-sys.matlab 3-axis plot - comp.soft-sys.matlab Multiple ... display video in a GUI - comp.soft-sys.matlabIn a loop, I load a frame, calculate the mean > in red, green, and blue, then switch over to another axes to plot the > mean from the start of the movie up until the ... plotyy: setting ylim for both right & left - comp.soft-sys.matlab ...I plot multiple data series and ... The COLORdef parameter would switch to the traditional Matlab plot ... box plots with 2 different y axes - comp.soft-sys.matlab ..... plot ... return level plot - comp.soft-sys.matlabreturn level plot - comp.soft-sys.matlab Hello all, I have estimate ... display video in a GUI - comp.soft-sys.matlab... and blue, then switch over to another axes to plot ... Proc sort & gplot - comp.soft-sys.sas... 1; > > run; > > quit; > > Switch your xvar with yvar: > > =A0 plot ... for X Proc Gplot will silently switch them. The order of the character variable on the X axis ... change size and orientation of an output graph in epslatex ...Currently I am having a problem with switching my graph into portrait mode. ... set size .5,1 set output "out.tex" set multiplot title "plot" set xtics axis set ... Character variables to order horizontal axis in GPLOT - comp.soft ...... ordered in a particular (non alphabetical) way which is the horizontal axis in a plot. ... character variable as Y and have a numeric for X Proc Gplot will silently switch ... Disappearing contour labels - comp.soft-sys.matlabThe plot is coming out fine, but my contour labels are ... on UNIX I have found that text labels on the z-axis ... their contours and contour labels. However, when I switch ... How to use a popup menu value inside a function in a GUI? - comp ...... val = get(source,'Value'); switch str{val ... How can I make the plot button have access to temp and ... Get mouse coordinates inside axes - comp.soft-sys ... Nonlinear curve fit fails to converge - comp.soft-sys.matlab ...* If I had a long time series and the switch occurred early ... >> slm = slmengine(x,y,'plot','on','knots',[-4:.25:4 ... Yes, I did, mainly because the scaling of the x-axis was ... switching axes in Plot? - comp.soft-sys.math.mathematica | Google ...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= How can I switch axes in Excel 2003? - Yahoo! AnswersI'm using a scatter plot graph in Excel 2003 to plot a simple 2-variable relationship. No matter what format the data in the table is in (i.e. normal or ... 7/21/2012 6:33:15 PM
|