Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: is there a way to swap the axes in a Plot?

  • To: mathgroup at
  • Subject: [mg29950] Re: [mg29910] is there a way to swap the axes in a Plot?
  • From: Tomas Garza <tgarza01 at>
  • Date: Thu, 19 Jul 2001 03:57:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Yes, you may work with the plot points of your graph. I give you an example.
Take e.g. the sine function in the interval {-Pi/2, Pi/2}and obtain its

a = Plot[Sin[x], {x, -Pi/2, Pi/2}];

you may look at FullForm of the plot to see what's going on, i.e.,


Among other things you have there the list of the points which the plotting
 operation joins to produce the graph. You then take those points and invert
the order of the coordinates:

Cases[a, List[x_, y_] -> List[y, x], Infinity]

(see the on-line help browser to understand this operation). Then plot the

ListPlot[%, PlotJoined -> True];

and you obtain the graph of the inverse function, in this case arcsine. You
may check this by means of

Plot[ArcSin[x], {x, -1, 1}];

The two curves are identical.

Tomas Garza
Mexico City

> Is there an easy way to "transpose" the Plot of a graph?
> I know the inverse function in closed form (and it is impossible to 
> in closed form).
> In other words, I have an equation in closed form for:
> x =  f^-1[y]
> I want to Plot this inverse function, then "transpose" the graph so 
> the final graphic has x on the horizontal axis and y on the vertical 
> Any ideas?
> many thanks,
> David E. Burmaster

  • Prev by Date: Re: Integrate[1/x, x] ??
  • Next by Date: Re: Re: Placeholders in matrix notation
  • Previous by thread: Re: is there a way to swap the axes in a Plot?
  • Next by thread: Thickness Isn't Thickness