Y-axis plotting in Mathematica

I have one more question about Tungsten Mathematics. Is there anyone who knows how I can plot the y axis?

I hope this figure helps.

enter image description here

+8
function wolfram-mathematica plot
source share
5 answers

One possibility is to use ParametricPlot as follows:

 ParametricPlot[ {-y*Exp[-y^2], y}, {y, -0.3, 4}, PlotRange -> {{-2, 2}, All}, AxesLabel -> {"x", "y"}, AspectRatio -> 1/4 ] 

Example for plot with flipped axes

+7
source share
 ParametricPlot[{5 Sin[y], y}, {y, -2 \[Pi], 2 \[Pi]}, Frame -> True, AxesLabel -> {"x", "y"}] 

enter image description here


EDIT

None of the answers presented so far can work with the Plot Filling parameter. The output of the graph contains GraphicsComplex in this case (which, incidentally, interrupts Mr.Wizard replacements). To be able to fill (it does not work for a standard chart without filling), you can use the following:

 Plot[Sin[x], {x, 0, 2 \[Pi]}, Filling -> Axis] /. List[x_, y_] -> List[y, x] 

enter image description here

 Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}, Filling -> {1 -> {2}}] /. List[x_, y_] -> List[y, x] 

enter image description here

+9
source share

You can flip the axes after printing with Reverse :

 g = Plot[Sin[x], {x, 0, 9}]; Show[g /. x_Line :> Reverse[x, 3], PlotRange -> Automatic] 

enter image description here

With a little change, this also works for graphs using Filling :

 g1 = Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}]; g2 = Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}, Filling -> {1 -> {2}}]; Show[# /. x_Line | x_GraphicsComplex :> x~Reverse~3, PlotRange -> Automatic] & /@ {g1, g2} 

enter image description here

(It may be more reliable to replace RHS :> with MapAt[#~Reverse~2 &, x, 1] )


As a function

Here is the form I recommend using. It includes flipping the original PlotRange , rather than forcing PlotRange -> All :

 axisFlip = # /. { x_Line | x_GraphicsComplex :> MapAt[#~Reverse~2 &, x, 1], x : (PlotRange -> _) :> x~Reverse~2 } &; 

Used as: axisFlip @ g1 or axisFlip @ {g1, g2}


With Rotate may be another effect:

 Show[g /. x_Line :> Rotate[x, Pi/2, {0,0}], PlotRange -> Automatic] 

enter image description here

+9
source share

Just for fun:

ContourPlot is another alternative. Using the Thies Function:

 ContourPlot[-y*Exp[-y^2/2] - x == 0, {x, -2, 2}, {y, 0, 4}, Axes -> True, Frame -> None] 

enter image description here

RegionPlot is another

 RegionPlot[-y*Exp[-y^2/2] > x, {x, -2.1, 2.1}, {y, -.1, 4.1}, Axes -> True, Frame -> None, PlotStyle -> White, PlotRange -> {{-2, 2}, {0, 4}}] 

enter image description here

And finally, minimized REALLY using ListCurvePathPlot and Solve :

 Off[Solve::ifun, FindMaxValue::fmgz]; ListCurvePathPlot[ Join @@ Table[ {x, y} /. Solve[-y*Exp[-y^2/2] == x, y], {x, FindMaxValue[-y*Exp[-y^2/2], y], 0, .01}], PlotRange -> {{-2, 2}, {0, 4}}] On[Solve::ifun, FindMaxValue::fmgz]; 

enter image description here

Off topic

Reply to Sjoerd None of the answers given thus far can work with Plot Filling option .

Answer: Not required

 f={.5 Sin[2 y],Sin[y]}; RegionPlot[Min@f<=x<=Max@f,{x,-1,1},{y,-0.1,2.1 Pi}, Axes->True,Frame->None, PlotRange->{{-2,2},{0,2 Pi}}, PlotPoints->500] 

enter image description here

+7
source share

Depending on how you want the axis labels to be displayed, you can simply wrap the code for the original graph in the Rotate function.

+5
source share

All Articles