Skip to main content

How can one find undocumented options or option values in Mathematica?


Mathematica has a lot of undocumented or poorly documented options.



  1. How does one go about working out if there is an undocumented option that might solve a particular problem?

  2. How does one work out what the universe of possible values the option might take are? (This also applies to options whose existence is documented, but where the range of valid values isn't.)




As background, here is a collection of ones I and others have found so far:


Graphics



The Method option is an option for Graphics and related commands like BarChart. It is mentioned in the notes in the documentation and turns up in Options[Graphics] but is not listed as an option in the documentation with any examples. There are many sub-options, none of which are explicitly documented.




  • Method -> {"ShrinkWrap" -> True} removes whitespace that Mathematica adds as a tiny rim to each plot. (pointed out by Sjoerd)




  • Method -> {"GridLinesInFront" -> True} does what it says (see Brett Champion's answer to this question and this MathGroup thread). Dynamic GridLines using this option are present in much of the graphical Wolfram|Alpha output (See, e.g. the edited number line code).




  • Method -> {"AxesInFront" -> True} also does what it says. (see TomD's comment on Brett's answer)





  • Method -> {Refinement -> {ControlValue -> angle}} sets the angle that decides when two points in a plot are not further subdivided - default is 5\[Degree]. (see Yaro's answer here and the relevant page in Stan Wagon's book. Also, a Plot version comparison by Alexey)




  • The option "MessagesHead" is used to track the origin of calls to Plot, etc., made by dependent plot functions such as LogPlot, LogLinearPlot, and DateListLogPlot. This allows the correct options and messages to be passed to and from the general function. An example of its use can be seen in this question.




  • ImageSizeRaw option for various plotting and graphics functions is not documented, but turns out to be important for embedding CDFs into web pages.





  • PrivateFontOptions -> {"OperatorSubstitution" -> False}, as documented here, stops minus signs, parentheses and the like from being in Mathematica's special fonts rather than the selected text font.




  • s0rce discovered that the ScalingFunctions option works for line plots (ListPlot, Plot, etc). Possible values include "Reverse", "Log" "Log10" – the last of these being itself undocumented.




  • Not strictly a graphics function, but often used to create nice-looking ticks, FindDivisions has an undocumented Method option: for example, FindDivisions[{-1.8,8.9}, 6, Method -> "ExtendRange"] gives the encompassing divisions {-2, 0, 2, 4, 6, 8, 10}, as does Method -> Automatic; any other setting for Method gives the inner divisions: {0, 2, 4, 6, 8}.





  • You can control the amount a PieChart segment pops out of the chart when you click it using SetOptions[Charting'iSectorChart, {PopoutSpacing -> n}], where n is numeric. The default is 0.2; for fun, try a negative number. You can suppress this behaviour altogether using SetOptions[Charting'SectorChart, {Popout -> False}] (in both these examples, change the quote mark to a backquote).




  • For some Plot functions the setting for the PlotStyle option can be specified as a function as well as a list of graphics directives. The earliest reference for this undocumented feature is this answer by Simon Woods. Additional examples of this PlotStyle usage for Plot and ParametricPlot are: this, this, this, and this.




Panels


As noted in an earlier question, these options pop up in some graphics/panels, but are unrecognised when one uses them explicitly in Panel, Graphics or related structures:



  • LineColor


  • FrontFaceColor

  • BackFaceColor

  • GraphicsColor


Legends


There seem to be a lot of undocumented options here:



  • AssembleLegendContainer

  • BubbleScaleLegend

  • ColorGradientLegend


  • ContourLegend

  • CurveLegend

  • GridLegend

  • Legend

  • LegendContainer: SetOptions[Legending`GridLegend, Legending`LegendContainer -> Identity] removes the border from legends (thanks to Mr.Wizard)

  • LegendHeading

  • LegendImage

  • LegendItemLayout

  • LegendLayout

  • LegendPane


  • LegendPosition

  • LegendReap

  • Legends

  • LegendSize

  • LegendSow


Equation-solving and minimisation/optimisation



  • Evaluated -> False option of FindRoot (TomD in comments)



System options for evaluation


Per acl's answer below, SystemOptions[] reveals many hidden options using the following syntax. These can be set using SetSystemOptions[].



  • "PackedArrayOptions" /. SystemOptions[]

  • "CompileOptions" /. SystemOptions[]


Although this book by Nancy Blachman has been written for Version 2, it is still not a bad starting point: http://www.amazon.com/Mathematica-Quick-Reference-Version-Spiral/dp/0201628805



Answer



One thing you can do is look for options which appear in a function's Options but do not have a ::usage message. Of course, some of the results actually are documented in the help, they just don't have a usage message. Here's a function to do it:


undoc[x_Symbol]:=Select[Options[x],!StringQ@MessageName[Evaluate@First@#,"usage"]&];

undoc[_] = {};

(* e.g. *)
undoc[Plot]
Out[3]= {Evaluated->Automatic,ImageSizeRaw->Automatic}

The following runs this function on all symbols in System context, and presents the results in a grid. Some functions (like Cell) have huge lists of options with no usage message, these ones I skip over (just printing out the function name) to save space.


Grid[Select[{#,undoc[Symbol[#]]}&/@Names["System`*"],
Last@#=!={}&&(Length@Last@#<10||Print@First@#)&],Frame->All]


enter image description here


Comments

Popular posts from this blog

front end - keyboard shortcut to invoke Insert new matrix

I frequently need to type in some matrices, and the menu command Insert > Table/Matrix > New... allows matrices with lines drawn between columns and rows, which is very helpful. I would like to make a keyboard shortcut for it, but cannot find the relevant frontend token command (4209405) for it. Since the FullForm[] and InputForm[] of matrices with lines drawn between rows and columns is the same as those without lines, it's hard to do this via 3rd party system-wide text expanders (e.g. autohotkey or atext on mac). How does one assign a keyboard shortcut for the menu item Insert > Table/Matrix > New... , preferably using only mathematica? Thanks! Answer In the MenuSetup.tr (for linux located in the $InstallationDirectory/SystemFiles/FrontEnd/TextResources/X/ directory), I changed the line MenuItem["&New...", "CreateGridBoxDialog"] to read MenuItem["&New...", "CreateGridBoxDialog", MenuKey["m", Modifiers-...

How to thread a list

I have data in format data = {{a1, a2}, {b1, b2}, {c1, c2}, {d1, d2}} Tableform: I want to thread it to : tdata = {{{a1, b1}, {a2, b2}}, {{a1, c1}, {a2, c2}}, {{a1, d1}, {a2, d2}}} Tableform: And I would like to do better then pseudofunction[n_] := Transpose[{data2[[1]], data2[[n]]}]; SetAttributes[pseudofunction, Listable]; Range[2, 4] // pseudofunction Here is my benchmark data, where data3 is normal sample of real data. data3 = Drop[ExcelWorkBook[[Column1 ;; Column4]], None, 1]; data2 = {a #, b #, c #, d #} & /@ Range[1, 10^5]; data = RandomReal[{0, 1}, {10^6, 4}]; Here is my benchmark code kptnw[list_] := Transpose[{Table[First@#, {Length@# - 1}], Rest@#}, {3, 1, 2}] &@list kptnw2[list_] := Transpose[{ConstantArray[First@#, Length@# - 1], Rest@#}, {3, 1, 2}] &@list OleksandrR[list_] := Flatten[Outer[List, List@First[list], Rest[list], 1], {{2}, {1, 4}}] paradox2[list_] := Partition[Riffle[list[[1]], #], 2] & /@ Drop[list, 1] RM[list_] := FoldList[Transpose[{First@li...

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...