【问题标题】:How can I find all possible values for an option in Mathematica?如何在 Mathematica 中找到选项的所有可能值?
【发布时间】:2012-01-03 21:31:45
【问题描述】:

如果我有一个选项,例如AxesStyle,我怎样才能找到它的可能值?我知道其中一个可能的值是Arrowheads,但我能找到其他值吗?我一直在寻找列表或类似的东西,但到目前为止都没有成功。

是否有类似Options[]?TicksStyle 的命令?我知道这些命令不是为了这个,只是为了说明问题。

【问题讨论】:

  • the documentation 中所示,对于各种Graphics 函数,Axes 是布尔值或布尔值数组,指示哪些轴将包含在给定的Graphics 对象中.
  • 目前,无法找到给定选项的所有可能值。在 Prashant 的回答下,请参阅 this related question 和 Sjoerd 的 cmets。

标签: wolfram-mathematica


【解决方案1】:

有时,选项的可能值没有完整记录。例如,尝试找出在Plot 中使用选项Method 时的合法值。 Plot 的参考页面仅给出了 Method 的默认值,并以非常笼统的术语对其进行了描述。在该页面的示例部分,Method 甚至不包含在示例选项中。 Method 的参考页面似乎也没有提供任何帮助。在后一页上,有一个指向指南页面Graphics Options And Styling 的链接,在该指南页面上,“方法”项出现在“调整渲染”类别下——但同样没有帮助说明哪些值可能可用!

【讨论】:

    【解决方案2】:

    如果您检查帮助文件以了解您所询问的各种内容并单击“更多信息”下拉菜单,它将为您提供所有选项。

    编辑:为澄清起见,请务必查看帮助文件以了解您要查找的特定设置,而不是使用它的功能。

    【讨论】:

    • 谢谢,我已经看到了。它为我提供了所有可能的选项,每个选项都有一个值,但其他选项呢?例如对于 Plot->FillingStyle-> 它是自动的,但是如何找出其他可能的选择呢?
    • @balboa - 例如,您可以在 Plot - Options - FillingStyle 下查看更多信息,或直接在 FillingStyle 下查找其他示例。但这并不全面。在此处尝试更多示例。
    • 您查看了Plot 的选项。这显示了在Plot 中使用的FillingStyle 的默认值。如果您查看FillingStyle 的帮助页面,它将提供更多信息。例如,该帮助页面上的第一条信息显示“FillingStyle->g 指定默认情况下应使用指定的图形指令完成所有填充。”
    • 好的,我发现它有点复杂,据我所知,mathematica 列出选项的可能值并不容易。我应该熟悉指令。
    【解决方案3】:

    查找选项文档的主要位置是该选项的文档页面,以及采用该选项的函数的文档页面。打开各个部分,从 More Information 开始,但也包括像 Scope 这样的部分(通常有子类别。)

    在查看函数文档时,有一个标题为 Options 的完整部分,其中包含单独的选项作为子部分。所以你可以看看 ListPlot > Examples > Options > Filling 里面包含了很多。

    在查看选项文档时,尤其是图形函数,示例可能只是显示了如何将选项与代表性函数一起使用,例如 Plot。通常ListPlotLogPlot等类似的函数会接受类似的选项设置。

    【讨论】:

    • 感谢您的回答,小节中的这些示例很有用。
    【解决方案4】:

    正如您在问题中所指出的,您可以使用“选项”来查看可用的内容。

    所以,

    Options[Plot]
    

    返回,

    {AlignmentPoint -> Center, AspectRatio -> 1/GoldenRatio, Axes -> True,
    AxesLabel -> None, AxesOrigin -> Automatic, AxesStyle -> {}, 
    Background -> None, BaselinePosition -> Automatic, BaseStyle -> {}, 
    ClippingStyle -> None, ColorFunction -> Automatic, 
    ColorFunctionScaling -> True, ColorOutput -> Automatic, 
    ContentSelectable -> Automatic, CoordinatesToolOptions -> Automatic, 
    DisplayFunction :> $DisplayFunction, Epilog -> {}, 
    Evaluated -> Automatic, EvaluationMonitor -> None, 
    Exclusions -> Automatic, ExclusionsStyle -> None, Filling -> None, 
    FillingStyle -> Automatic, FormatType :> TraditionalForm, 
    Frame -> False, FrameLabel -> None, FrameStyle -> {}, 
    FrameTicks -> Automatic, FrameTicksStyle -> {}, GridLines -> None, 
    GridLinesStyle -> {}, ImageMargins -> 0., ImagePadding -> All, 
    ImageSize -> Automatic, ImageSizeRaw -> Automatic, LabelStyle -> {}, 
    MaxRecursion -> Automatic, Mesh -> None, MeshFunctions -> {#1 &}, 
    MeshShading -> None, MeshStyle -> Automatic, Method -> Automatic, 
    PerformanceGoal :> $PerformanceGoal, PlotLabel -> None, 
    PlotLegends -> None, PlotPoints -> Automatic, 
    PlotRange -> {Full, Automatic}, PlotRangeClipping -> True, 
    PlotRangePadding -> Automatic, PlotRegion -> Automatic, 
    PlotStyle -> Automatic, PlotTheme :> $PlotTheme, 
    PreserveImageOptions -> Automatic, Prolog -> {}, 
    RegionFunction -> (True &), RotateLabel -> True, 
    TargetUnits -> Automatic, Ticks -> Automatic, TicksStyle -> {}, 
    WorkingPrecision -> MachinePrecision}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-05
      • 2015-07-28
      • 2019-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-24
      • 1970-01-01
      相关资源
      最近更新 更多