RE: Switching x and y axes in 2D plots
- To: mathgroup at smc.vnet.net
- Subject: [mg31234] RE: [mg31223] Switching x and y axes in 2D plots
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 20 Oct 2001 04:27:08 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Bertil, ParametricPlot[{x,f[x]},{x,xmin,xmax}] is a substitute for Plot[f[x],{x,xmin,xmax}] So to plot a function x = f[y] you could use: ParametricPlot[{f[y],y},{y,ymin,ymax}] For example: f[y_] := y Sin[y] ParametricPlot[{f[y], y}, {y, -Pi, Pi}]; If you have a lot of graphic elements, and you want to switch them all, another method is to extract the primitive graphics and then use a transformation rule on all the points. {primitive graphics}/.{x_?NumericQ, y_NumericQ}->{y,x} This is easy to do with my DrawGraphics packages because the primitive graphics are immediately available. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ > From: Bertil Jonell [mailto:d9bertil at dtek.chalmers.se] To: mathgroup at smc.vnet.net > > > Is there an easy way of switching the x and y axes in 2D plots? > > I'm asking because I'm trying to print out an maneuvering envelope > plot, and they traditionally have altitude (independent variable) on > the *vertical* axis and velocity (dependent) on the horizontal axis. > > -bertil- (d9bertil at dtek.chalmers.se) > -- > "It can be shown that for any nutty theory, beyond-the-fringe > political view or > strange religion there exists a proponent on the Net. The proof > is left as an > exercise for your kill-file." >