I have another question about Wolfram Mathematica. Is there someone that knows how I can plot a graphic on the y axis?
I hope that the figure helps.
PlotRange (Built-in Mathematica Symbol) PlotRange is an option for graphics functions that specifies what range of coordinates to include in a plot. Options for Graphics (Mathematica Tutorial) When Mathematica plots a graph for you, it has to make many choices.
Plotting functions in the Cartesian plane is such a simple task with Wolfram|Alpha: just enter the function you are looking to graph, and within seconds you will have a beautiful result.
ParametricPlot[{5 Sin[y], y}, {y, -2 \[Pi], 2 \[Pi]},
Frame -> True, AxesLabel -> {"x", "y"}]
EDIT
None of the answers given thus far can work with Plot's Filling
option. Plot's output contains a GraphicsComplex
in that case (which, incidentally, breaks Mr.Wizard's replacements). To get the filling capability (it doesn't work for a standard plot without filling) you could use the following:
Plot[Sin[x], {x, 0, 2 \[Pi]}, Filling -> Axis] /. List[x_, y_] -> List[y, x]
Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}, Filling -> {1 -> {2}}]
/. List[x_, y_] -> List[y, x]
You can flip the axes after plotting with Reverse
:
g = Plot[Sin[x], {x, 0, 9}];
Show[g /. x_Line :> Reverse[x, 3], PlotRange -> Automatic]
With a minor change this works for plots using Filling
as well:
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}
(It may be more robust to replace the RHS of :>
with MapAt[#~Reverse~2 &, x, 1]
)
Here is the form I recommend one use. It includes flipping of the original PlotRange
rather than forcing PlotRange -> All
:
axisFlip = # /. {
x_Line | x_GraphicsComplex :>
MapAt[#~Reverse~2 &, x, 1],
x : (PlotRange -> _) :>
x~Reverse~2 } &;
To be used like: axisFlip @ g1
or axisFlip @ {g1, g2}
A different effect can be had with Rotate
:
Show[g /. x_Line :> Rotate[x, Pi/2, {0,0}], PlotRange -> Automatic]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With