6
$\begingroup$

It seems like PlotTheme -> "Monochrome" produces up to 8 different dashing styles for Plot. I know one way to overcome this is to use ListLinePlot and use PlotMarkers to produce more combinations. However, I am wondering if there are simpler ways to just assign more dashing styles in the Monochrome theme? For example, as seen below, the styles repeat themselves.

Plot[Evaluate@Table[2 p + y, {p, 0, 1, 0.1}], {y, 0, 4}, 
 PlotTheme -> "Monochrome"]

enter image description here

$\endgroup$
  • $\begingroup$ It's more than you get with the normal plot theme, there the colors start repeating after p=5 $\endgroup$ – Jason B. Feb 22 '17 at 21:33
  • $\begingroup$ A humble recommendation to the poser: Ask the minimally informative question. There's no need to complicate your question by using functions requiring Exclusions, or large number of PlotPoints, or to choose the size and FontFamily, etc. to learn what you seek. Plot[Evaluate@Table[a x^2, {a, 1, 2, .1}], {x, 0, 1}, PlotTheme -> "Monochrome"] suffices. $\endgroup$ – David G. Stork Feb 22 '17 at 21:47
  • $\begingroup$ @DavidG.Stork good point. I'll change it. $\endgroup$ – MathX Feb 22 '17 at 21:51
  • $\begingroup$ @JasonB. They repeat after 5? Which ones? $\endgroup$ – rcollyer Feb 22 '17 at 21:59
  • $\begingroup$ @rcollyer - they repeat after 5 if you squint..... that blue followed by a yellow looks similar to the first blue followed by a yellow. But yeah, I was clearly wrong $\endgroup$ – Jason B. Feb 22 '17 at 22:05
3
$\begingroup$

One solution would be to double the number of plot styles under this theme by making them gray. So you would have 8 black styles, followed by 8 gray styes.

Learning from the answers here, you could do this via

System`PlotThemeDump`resolvePlotTheme["Monochrome", "Plot"] = 
 ReplaceAll[
  System`PlotThemeDump`resolvePlotTheme["Monochrome", "Plot"],
  HoldPattern[Rule["DefaultDashing", dashing_List]] :> 
   Rule["DefaultDashing", Join[dashing, Thread[{Gray, dashing}]]]];

Now you can have up to 16 distinct styles,

f[x_] := x^4 + x
g[x_] := x^2
tSet = Table[f[x] + c*g[x], {c, -4, 8}];
Plot[Evaluate@tSet, {x, -2, 2}, PlotTheme -> "Monochrome", 
 PlotLegends -> "Expressions"]

Mathematica graphics

$\endgroup$
2
$\begingroup$
PlotStyle -> (Dashing[#]& /@ Table[i, {i, .01, .09, .01}])

or whatever style you like:

{Dashing[{.02, .05, .01}],Dashing[.04], Dashing[{.01, .02, .01, .06}],...}

or of course AbsoluteDashing

$\endgroup$
  • $\begingroup$ This works but loses the first seven wonderful default styles of the Monochrome theme. Can it be done somehow to be used after the default styles have been exhausted? $\endgroup$ – MathX Feb 22 '17 at 21:58
  • $\begingroup$ You're making this harder than it need be. Blow up a plot and then by hand enter the dashing values for the five styles (matching the rendered lines), and then you're done. You'll save so much time if you do this. [Over and out.] $\endgroup$ – David G. Stork Feb 22 '17 at 22:16
  • $\begingroup$ I can adopt your suggestion by using AbsoluteDashing[{d1, d2, d3,..}] that has the ability to produce all different dashing styles that I want. Thanks! $\endgroup$ – MathX Feb 22 '17 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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