MathGroup Archive 2012

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

Search the Archive

Re: switching axes in Plot?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127376] Re: switching axes in Plot?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Fri, 20 Jul 2012 03:54:33 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <gmu8qa$glt$1@smc.vnet.net>

ParametricPlot is also useful

f[x_] = x^2 - 5 x + 6;

Plot[f[x], {x, 1, 4}]

ParametricPlot[{f[x], x}, {x, 1, 4}]


Bob Hanlon


On Thu, Jul 19, 2012 at 3:51 AM,  <windlessaegis at gmail.com> wrote:
> On Wednesday, February 11, 2009 5:20:58 AM UTC-5, (unknown) wrote:
>> When using Plot to plot F[x] as a function of x, Mathematica automatically
>> assigns the independent variable x to the horizontal axis and the dependent  variable F[x] to the horizontal.  I often want to switch this around so that the independent variable runs on the vertical axis and the dependenton the horizontal.  I feel sure there ought to be a simple way to tell Plot to make this change but I have never found it and instead have resorted to convoluted approaches.  Can anyone tell me what the simple trick is, if it exists?
>> Thanks
>> John Finnigan
>
> Hi,
>
> I just found this looking for the answer myself.  Then it hit me: try changing the order that you define the variables within the plot operation.
>
> So as an example, given:
>
> ContourPlot[
>  Evaluate[Re[
>    Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {x, -3,
>   3}, {y, -3, 3}]
>
> To swap axes, just define y and then x -- like this:
>
> ContourPlot[
>  Evaluate[Re[
>    Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {y, -3,
>   3}, {x, -3, 3}]
>



  • Prev by Date: Re: Evaluate code fragment without making new cell for it?
  • Next by Date: Re: NDSolve with NIntegrate where Integral is a function of x
  • Previous by thread: Re: switching axes in Plot?
  • Next by thread: OptionsExplorer test is needed