Re: Switching x and y axes in a plot
- To: mathgroup at smc.vnet.net
- Subject: [mg41529] Re: Switching x and y axes in a plot
- From: bobhanlon at aol.com (Bob Hanlon)
- Date: Sat, 24 May 2003 01:07:08 -0400 (EDT)
- References: <bakj5v$l89$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
f[x_] := x^2-4x+4; p1 = Plot[f[x], {x,-6,10}]; Show[p1 /. {x_, y_} :> {y,x}, AspectRatio->GoldenRatio, ImageSize->178]; Plot[Evaluate[x /. Solve[y==f[x], x]], {y,0,f[10]}, AspectRatio->GoldenRatio, ImageSize->178]; Needs["Graphics`ImplicitPlot`"]; ImplicitPlot[y==f[x], {y,0,f[10]}, AspectRatio->GoldenRatio, ImageSize->178]; For a scatter plot go to the on-line help's master index and type scatter. You will be directed to ListPlot Bob Hanlon In article <bakj5v$l89$1 at smc.vnet.net>, Gregory Lypny <gregory.lypny at videotron.ca> wrote: << Subject: Switching x and y axes in a plot From: Gregory Lypny <gregory.lypny at videotron.ca> To: mathgroup at smc.vnet.net Date: Fri, 23 May 2003 07:38:39 +0000 (UTC) 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