# Tag Info

44

I use this function getList[name_String] := Module[{options, idx}, options = Names[name <> "*"]; options = ToExpression /@ options; options = {#, Options[#]} & /@ options; idx = Range[Length[options]]; options = {#[[1]], TableForm[#[[2]]]} & /@ options; options = Insert[options[[#]], #, 1] & /@ idx; options = Insert[...

42

I already answered this question on StackOverflow but since old questions can no longer be migrated without undue trouble I shall reproduce my answer here. There are two different categories of graphical objects in a Plot output. The plotted lines of the functions (Sin[x], Cos[x]) and their styles are "hard coded" into Line objects, which Graphics can ...

36

For this purpose, I wrote a small Symbol Information Palette. This palette let's you quickly look up usages, options and attributes of symbols and was tested on Mac OSX and Linux. Installation The source code is hosted on my GitHub site but to preview or install the palette you only have to evaluate this: Get["http://goo.gl/QPywk"] The link is just ...

33

Ah well... this is not robust, but probably of educational value and useful as a starting point for other post-processing needs on Graphics or Graphics3D expressions: p = Plot[Sin[x], {x, 0, 1}] col = Cases[p, _Hue, Infinity][[1]]; Show[p /. col -> Red] Update: As pointed out by matheorem, Version 10 switched from Hue to RGBColor, so the ...

30

I doubt you can find a chart for all options, but take a look at this: For this and other insights two courses by Yu-Sung are a must (there are notebooks and videos there): Graphics Language Quick Start Visualization: Advanced 3D Graphics The above chart is from the 1st one. The one @Kuba links in the comment to your question is from the 2nd - I show ...

29

OptionsPattern: Therefore declare Options for both myGrid and Grid as valid: Options[myGrid] = {Frame -> All, "Tooltip" -> False}; myGrid[content_, opts : OptionsPattern[{myGrid, Grid}]] := . . . Then: myGrid[mat, Background -> Blue] Grid[mat, Background -> RGBColor[0, 0, 1], Frame -> All] With no error message.

28

Yes, it is possible: The idea is to look at the underlying cell expressions in the documentation for those string property tables. As I said already in my comment above, basically we have two different situations here: the trend since Mathematica V6 that many options are not symbols any more but rather strings. function arguments, that are given as ...

25

A guess My guess is that you have just run into the details of OptionValue implementation, which are also responsible for its "magical" behavior. OptionValue has to somehow know which function it is in, and tracing the execution of f4[] shows that apparently the following expansion is happening before any evaluation is attempted for the r.h.s.: OptionValue[...

24

Usual caveats about using undocumented functions aside, here is how one might use InternalWithLocalSettings[]: With[{plotOptions = Options[Plot]}, InternalWithLocalSettings[SetOptions[Plot, PlotStyle -> Green], Plot[Sin[x], {x, -π, π}], SetOptions[Plot, plotOptions]]] but I do not ...

22

Lets see the Attributes of Plot3D Attributes[Plot3D] {HoldAll, Protected, ReadProtected} The HoldAll is the reason why your options are not read within the Plot3D command. In such situations (e.g NIntegrate, Plot,..) to resolve the values of a symbol (here options) within these commands we tend to use Evaluate to forcefully override this attribute. So ...

22

The complete list of possible methods is given by OptimizationNMinimizeDump$Methods: OptimizationNMinimizeDump$Methods (* -> {Automatic, DifferentialEvolution, NelderMead, SimulatedAnnealing, RandomSearch, NonlinearInteriorPoint} *) As you can see, there is one undocumented method: NonlinearInteriorPoint. The probable reason for its being ...

22

Thanks for asking this question; I might not have discovered this customizable area without it. The auto-completion option values are automatically loaded on Front End start from: FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "SystemResources", "FunctionalFrequency", "OptionValues"}] This directory contains a series of Package (.m) ... 21 Here is what I do in such cases ([edit from 01/10/2020 - apparently, this technique has been exposed on this site earlier, at least partially, in this nice answer by Mr.Wizard - which I definitely read but must have forgotten at the time of posting my answer]) : ClearAll[g, f]; Options[f] = {optA -> 1, optB -> 1, optC -> 1}; f[x_, opts : ... 19 As I described here, we can obtain diagnostic output from NMinimize using an internal variable, NMinimize; (* Auto-load package, in case we haven't called NMinimize already *) OptimizationNMinimizeDump$DiagnosticLevel = 3; where the 3 means, as mentioned previously, that we would like to receive information at an intermediate level of detail. In fact, ...

19

AbsoluteOptions is known as very buggy function and the bug in determining the true PlotRange has very long history... You could try my Ticks-based workaround for getting the complete PlotRange (with PlotRangePadding added): completePlotRange[plot:(_Graphics|_Graphics3D|_Graph)] := Last@ Last@Reap[ Rasterize[ Show[plot, Axes -> True, ...

19

In older versions (5 and before), most option names were symbols. It's since about version 6 that string option names have proliferated. I think that the reason is to avoid cluttering the name space. Once you introduce a new name, it won't be available for package authors to use for other purposes (in particular, function names). At least not without ...

19

Let me first answer your second question, since I can only guess about the main question: I also observed that the syntax colouring (version 10, windows 7) suggests that Trace can be used with only two arguments. It's really just the coloring that goes wrong and has nothing to do with functionality. You can see that it is not even related to ...

19

Normally I like to use On and Off for this kind of tracing as it is easy to set up without modifying any symbols. However, it does not immediately work in this case: On[Roots] Solve[x^3 - 2 x + 12 == 0, x]; Off[] This does not produce any trace messages. Something must be using Quiet to suppress them. We can check this hypothesis: On[Quiet] Solve[x^3 - ...

19

Edit: Fading overlay window In order to get a top dock element with real transparency, one can create a window that overlays the current notebook window and adjusts its position together with it. With[{nb = EvaluationNotebook[]}, DynamicModule[{wm, ws}, CreateWindow[ PaletteNotebook[ {DynamicWrapper[TextCell["Click OK to close", Orange], ...

18

Interactive illustration of the most fundamental properties: Manipulate[ Column[{ Overlay[{ Framed[Graphics[{ LightYellow, Rectangle[{-plotRangePadding - plotRange, -plotRangePadding - plotRange}, {plotRangePadding + plotRange, plotRangePadding + plotRange}], LightGreen, Rectangle[{-plotRange,...

18

I don't know why no one mentioned this, but all you have to do is to use a special form of OptionsPattern: pfunc[x0_, plotopts : OptionsPattern[{Plot, pfunc}]] := your-code where inside OptionsPattern go all sub-functions you need, in a list. Now everything is fine and dandy. This has been explained already in this answer of Mr. Wizard, so this answer and ...

18

After some spelunking it appears I have an answer and solution: the behavior is as intended, and it is controlled by a Method option "AllowMicroRanges". ListLinePlot[dat, PlotRange -> Full, Method -> {"AllowMicroRanges" -> #} ] & /@ {True, False} It seems this option may also be given directly, outside of Method, but if you wish to ...

17

The problem we encounter here is an instance of rather unexpected limitations of equation solving functionality (i.e. Modulus option in Reduce), e.g. this question : Strange behaviour of Reduce for Mod[x,1] provides another example which has been fixed in the newest version (9.0) of Mathematica. Since Modulus unexpectedly doesn't work here we can take ...

17

Introduction What are good (robust?, simple?, efficient?) patterns for doing this kind of code-switching? This answer outlines a development strategy that can produce robust and extensible method option handling. Conceptually and development-wise, it is not that simple, but it has been successfully applied in large software projects with complicated ...

17

I have used several methods, including the ones in the other answers. I have found that the simplest method is InternalInheritedBlock as it allows for temporary changes to a symbol to be made, including changes to Options. For example, Internal`InheritedBlock[{Plot}, SetOptions[Plot, PlotStyle -> Red, Frame -> True]; Plot[Sin[x], {x, 0, 2 Pi}] ] ...

16

As Mr.Wizard indicated, you can also reconstruct the plot using the data. Here is an example: restylePlot2[p_, op : OptionsPattern[ListLinePlot]] := ListLinePlot[Cases[Normal@p, Line[x__] :> x, ∞], op, Options[p]] then we can set the style as we do in plot. For example restylePlot2[myplot2, PlotStyle -> {{Green, Thick, Dashed}, {Thickness[...

16

The main points of this answer are that,first, it seems rather difficult to have a fully universal mechanism for option-validation, and second, such a mechanism is not currently available in Mathematica on the language level (meaning automation of complete option-checking, including both the option's name and value). In the particular case in question, ...

16

Padding Without padding of any kind the over-all aspect ratio and element (primitive) aspect ratio are the same and as specified: g0 = Graphics[{Opacity[0.5, Red], Rectangle[{0, 0}, {3, 2}]}, AspectRatio -> 2/3, Background -> GrayLevel[0.8], PlotRangePadding -> 0] (There is a one pixel discrepancy along the right edge where the background ...

16

Let us assume that you are designing a function which can take its own unique options, but also shares option names with Plot. What is the best way to implement such a function myPlot? Below I will try to give a complete guide on how to do this. There are two common approaches: The default values for Plot-specific options will be taken directly from Plot....

Only top voted, non community-wiki answers of a minimum length are eligible