3

Can I change the PlotStyle of a plot similar to how ColorFunction works? Minimal example:

Plot[Sin[x], {x, 0, 2 Pi}, ColorFunction -> (If[#2 > 0.5, Red, Black] &),
  ColorFunctionScaling -> False]

Mathematica graphics

Now, instead of Red and Black, I'd like Dashed and Black. Possible?

Chris K
  • 20,207
  • 3
  • 39
  • 74
  • Thanks for the link, it's perfect. For the record, Plot[Sin[x], {x, 0, 2 Pi}, MeshFunctions -> {#2 &}, Mesh -> {{0.5}}, MeshShading -> {Black, Directive[Black, Dashed]}, MeshStyle -> None] solves my problem. – Chris K Feb 20 '18 at 16:26

0 Answers0