在Mathematica中绘制y轴

Bla*_*dow 9 plot wolfram-mathematica function

我还有一个关于Wolfram Mathematica的问题.有人知道如何在y轴上绘制图形吗?

我希望这个数字有所帮助.

在此输入图像描述

Sjo*_*ies 9

ParametricPlot[{5 Sin[y], y}, {y, -2 \[Pi], 2 \[Pi]}, 
                Frame -> True,  AxesLabel -> {"x", "y"}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


编辑

到目前为止给出的答案都不能与Plot的Filling选项一起使用.GraphicsComplex在这种情况下,Plot的输出包含一个(顺便提一下,打破了Mr.Wizard的替换).要获得填充功能(它不适用于没有填充的标准图),您可以使用以下内容:

Plot[Sin[x], {x, 0, 2 \[Pi]}, Filling -> Axis] /.  List[x_, y_] -> List[y, x]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Plot[{Sin[x], .5 Sin[2 x]}, {x, 0, 2 \[Pi]}, Filling -> {1 -> {2}}] 
   /. List[x_, y_] -> List[y, x]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Mr.*_*ard 9

您可以在绘图后翻转轴Reverse:

g = Plot[Sin[x], {x, 0, 9}];

Show[g /. x_Line :> Reverse[x, 3], PlotRange -> Automatic]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

通过一个小的改动,这适用于使用的情节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}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

(这可能是更健壮的替换的RHS :>MapAt[#~Reverse~2 &, x, 1])


作为一种功能

这是我建议使用的表格.它包括翻转原文PlotRange而不是强制PlotRange -> All:

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

用作:axisFlip @ g1axisFlip @ {g1, g2}


可以产生不同的效果Rotate:

Show[g /. x_Line :> Rotate[x, Pi/2, {0,0}], PlotRange -> Automatic]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Thi*_*cke 8

一种可能性是使用ParametricPlot这样的:

ParametricPlot[
  {-y*Exp[-y^2], y}, {y, -0.3, 4},
  PlotRange -> {{-2, 2}, All},
  AxesLabel -> {"x", "y"},
  AspectRatio -> 1/4
]
Run Code Online (Sandbox Code Playgroud)

带翻转轴的绘图示例


Dr.*_*ius 7

纯娱乐:

ContourPlot是另一种选择.使用Thies功能:

ContourPlot[-y*Exp[-y^2/2] - x == 0, 
            {x, -2, 2}, {y, 0, 4}, 
            Axes -> True, Frame -> None]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

RegionPlot是另一个

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}}]
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

最后,一个真正令人费解的方式使用ListCurvePathPlotSolve:

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];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

无关

回答Sjoerd的None of the answers given thus far can work with Plot's Filling option.

回复:没必要

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] 
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Ver*_*eia 5

根据您希望轴标签显示的方式,您可以在Rotate函数中包装原始Plot的代码.