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 smc.vnet.net
  • Subject: [mg29950] Re: [mg29910] is there a way to swap the axes in a Plot?
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Thu, 19 Jul 2001 03:57:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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
plot:

In[1]:=
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.,

In[2]:=
FullForm[a]

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:

In[3]:=
Cases[a, List[x_, y_] -> List[y, x], Infinity]

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

In[4]:=
ListPlot[%, PlotJoined -> True];

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

In[5]:=
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 
invert
> 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 
that
> the final graphic has x on the horizontal axis and y on the vertical 
axis.
>
> 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