3
$\begingroup$

I like the new Callout facility in Mathematica 11, but it's still quite clunky.

One of the issues I have is that I often like to have my labels in the same color as the corresponding curve in my plot. It would be great if CallOut had an option so it would color the labels the same as the curves that are being labeled, but that doesn't seem to be a built-in option.

So I do something like,

Plot[{Callout[Sin[x], Sin[x], 5, 
   LabelStyle -> Directive[ColorData[97, 1]], 
   CalloutMarker -> "Circle"], 
  Callout[Cos[x], Cos[x], 5.5, 
   LabelStyle -> Directive[ColorData[97, 2]], 
   CalloutMarker -> "Circle"]}, {x, 0, 2 π}, 
 GridLines -> Automatic, PlotRangeClipping -> False, 
 PlotRangePadding -> {{0, 0}, {0.1, 0.1}}]

which happens to work fine in the standard environments.

However, right now I am in the process of putting together a slideshow, and it turns out that Mathematica uses a slightly different plot theme based on which slideshow template is chosen.

I have no idea how to even find out what the plot theme is, and I have even less of a clue how to find out what ColorData would correspond to that theme. My attempts to figure things out through the OptionInspector have failed, unfortunately.

Anyhow can anyone tell me how I could find the correct ColorData call above? By poking around with

Short[ColorData[n, "ColorList"], 4]

I managed to guess that I should now use Colordata[98,n], but it would be really nice if there was a systematic way to figure this out.

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Thereof are a lot of interesting symbols in this context

Names["System`PlotThemeDump`*"] // Shallow
(* {"System`PlotThemeDump`a", 
"System`PlotThemeDump`aapl", "System`PlotThemeDump`all", 
"System`PlotThemeDump`allowmicroranges", 
"System`PlotThemeDump`angle", "System`PlotThemeDump`angle$", 
"System`PlotThemeDump`arg", "System`PlotThemeDump`att", 
"System`PlotThemeDump`axis", "System`PlotThemeDump`axisinfront", 
<<272>>} *)

Looking through the names, it seems that this is the one you want

System`PlotThemeDump`$ThemeStylesheetIndexed

This variable is initialized only after you've evaluated a plot in a given StyleSheet. After staring a new slide show, having chosen a given template, you can find out the default indexed colors via

System`PlotThemeDump`$ThemeStylesheetIndexed
Plot[{x, x + 1}, {x, 0, 3}]
System`PlotThemeDump`$ThemeStylesheetIndexed
ColorData[%, "ColorList"]

enter image description here

Not ideal, but this will give you the color list you are looking for.

$\endgroup$
4
  • $\begingroup$ Excellent, this works fine. Thanks! $\endgroup$
    – Pirx
    Feb 24, 2017 at 22:49
  • $\begingroup$ @Pirx - glad I could help. Also, feel free to revert the edits I made on the original question, just wanted to make the title more specific so it can help future users who do a search for this topic $\endgroup$
    – Jason B.
    Feb 24, 2017 at 22:55
  • $\begingroup$ I looked at your edits, and they're fine. You did remove some of my more colorful language, but that's fine, too ;-) $\endgroup$
    – Pirx
    Feb 24, 2017 at 22:56
  • 1
    $\begingroup$ Interestingly, on my machine `` SystemPlotThemeDump$ThemeStylesheetIndexed `` has the value {}, no matter what stylesheet I choose. (Win7, Mathematica 11.1.0.0) $\endgroup$ Aug 30, 2017 at 7:30

Your Answer

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

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