4
$\begingroup$
$Version
14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)

This seems to be similar to Global LabelStyle option does not work with SetOptions and SetOptions for CoordinatesToolOptions for DateListPlot?

Starting with a fresh kernel, the option ContourStyle->Opacity[0.1] works as expected,

m=2;

opt:=FilterRules[Options@ContourPlot3D,ContourStyle];

opt

ContourPlot3D[x==y,{x,-m,m},{y,-m,m},{t,-m,m},ContourStyle->Opacity[0.1]]

enter image description here

But SetOptions does not change the final plot.

SetOptions[ContourPlot3D,ContourStyle->Opacity[0.1]];

opt

ContourPlot3D[x==y,{x,-m,m},{y,-m,m},{t,-m,m}]

enter image description here


Is there any workaround for this and similar problems?

The definition of ContourPlot3D can be accessed by GeneralUtilities`PrintDefinitionsLocal, but the codes of passing options are quite complicated and I have no idea how to fix it.

$\endgroup$

1 Answer 1

4
$\begingroup$

It seems that PlotTheme has higher piority over other options like ContourStyle, and Charting`ResolvePlotTheme will generate a "default" option value of ContourStyle according to the theme, which will overwrite the the option value of ContourStyle from SetOptions.

Here is an ad hoc fixing, as in https://mathematica.stackexchange.com/a/80499/86893.

SetOptions[ContourPlot3D,ContourStyle->Opacity[0.1]];

(*load the code.*)
System`SampledPlotsDump`iContourPlot3D;

(*memorize the old definition.*)
old=DownValues[System`SampledPlotsDump`iContourPlot3D];

then we drop the option value of ContourStyle generated by Charting`ResolvePlotTheme: enter image description here

DownValues[System`SampledPlotsDump`iContourPlot3D]=
    ReplaceAll[old,
        HoldPattern[FilterRules[arg_,Verbatim[Except][Method]]]:>
            FilterRules[arg,Except[Method|ContourStyle]]
    ];

and SetOptions works as expected:

m=2;

ContourPlot3D[x==y,{x,-m,m},{y,-m,m},{t,-m,m}]

enter image description here

the original definition can be restored by

DownValues[System`SampledPlotsDump`iContourPlot3D]=old;

for fixing other options.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.