Re: Switching x and y axes in a plot
- To: mathgroup at smc.vnet.net
- Subject: [mg41516] Re: Switching x and y axes in a plot
- From: Bobby Treat <drmajorbob+MathGroup3528 at mailblocks.com>
- Date: Sat, 24 May 2003 01:03:19 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
This plots it both ways:
plot1 = Plot[Sin[x], {x, 0, 3Pi}];
plot2 = plot1 /. Line[{a__}] :> Line[Reverse /@ {a}];
Show@plot2
To plot it only the second way:
Show[Plot[
Sin[x], {x, 0, 3Pi}, DisplayFunction ->
Identity] /. Line[{a__}] :> Line[Reverse /@ {a}],
DisplayFunction -> $DisplayFunction]
Bobby
-----Original Message-----
From: Gregory Lypny <gregory.lypny at videotron.ca>
To: mathgroup at smc.vnet.net
Subject: [mg41516] Switching x and y axes in a plot
Hello everyone,
I'm new to Mathematica, so I hope you'll forgive my first couple of
naive questions.
I've used Plot to graph a parabola as follows: Plot[ax^2 - 2bx + c,
{x, xMin, xMax}]. Is there any way to plot the function so that y
appears on the horizontal axis and x on the vertical? (I realize the
parabola part is uninteresting; it's actually the solution to a
standard problem in financial economics involving the minimization of
investment portfolio risk for a given expected return.)
Another plot-related question, if I may: do all plots require the
specification of a domain as {x, xMin, xMax}? For example, how would I
create a scatter plot of experimental data where I have a long
two-column list or matrix consisting of x and y observations where the
data determine the domain and range?
Sincerely,
Gregory
Gregory Lypny
Associate Professor
Concordia University
___________________
"Better for us if you don't understand."
The Tragically Hip
http://pareto.concordia.ca