4
$\begingroup$

Let's say I would like to know all the Rules that apply to PlotTheme->"Detailed". I tried

Select[FullForm[Plot[x, {x, 0, 1}, PlotTheme -> "Detailed"]], Head[#] == Rule &, Infinity]

but I get the Error/Warning that FullForm was called with 0 arguments, which doesn't make sense to me. What would be the correct way to do this?

$\endgroup$
2
  • 2
    $\begingroup$ You should use Cases instead of Select like this: Cases[ Plot[x, {x, 0, 1}, PlotTheme -> "Detailed"], x_ /; Head[x] === Rule, Infinity ] $\endgroup$
    – flinty
    Commented Sep 14, 2021 at 12:57
  • 1
    $\begingroup$ In general if you are looking for rules you would also need to check for RuleDelayed, e.g., Cases[Plot[x, {x, 0, 1}, PlotTheme -> "Detailed"], x_ /; (Head[x] === Rule || Head[x] === RuleDelayed), Infinity]. In this particular case that only adds one DisplayFunction :> Identity $\endgroup$
    – Bob Hanlon
    Commented Sep 14, 2021 at 13:29

1 Answer 1

10
$\begingroup$

You can get the options associated with the plot theme "Detailed" using the (undocumented) internal function Charting`ResolvePlotTheme:

Charting`ResolvePlotTheme["Detailed", Plot] // Column

enter image description here

See also: Related Q/As

If you need the options for the legended graphics object produced by

 plot = Plot[x, {x, 0, 1}, PlotTheme -> "Detailed"]

you can use Part:

Head /@ {plot, plot[[1]], plot[[2]]}
{Legended, Graphics, Placed}
plot[[1, 2]]

enter image description here

$\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.