I dislike the orange style as the second default plot style, and I would like to swap it with the fourth, which is red.

Is there a relatively painless way of doing this?

  • 2
    $\begingroup$ FYI, I am told the first three colours are easily distinguishable for people that are colourblind. If you are only going to use three lines for example I would recommend sticking to the colour scheme since using green and red is considered particularly unfriendly for the colourblind. I heard that if you have a group of five man, you will have a 20% chance of having at least one colourblind. $\endgroup$
    – Ruud3.1415
    Commented Jul 19, 2017 at 15:20
  • 1
    $\begingroup$ If you take a look at this plot, you will almost see no contrast between the this and the fourth line ImageEffect[ Plot[{x, x/2, x^2, x^3}, {x, 0, 1}], {"ColorBlindness", "Deuteranopia"}] $\endgroup$
    – Ruud3.1415
    Commented Jul 19, 2017 at 15:34

1 Answer 1

Module[{colors}, colors = ColorData[97, "ColorList"]; 
   colors[[{2,4}]] = colors[[{4,2}]];
   Plot[Evaluate[Sin[# x] & /@ {1, 2, 3, 4, 5}], {x, -Pi, Pi}, PlotStyle -> colors, 
     PlotLegends -> "Expressions"]]

enter image description here


swap = Thread[ColorData[97, "ColorList"][[{2,4}]] -> ColorData[97, "ColorList"][[{4,2}]]];

Plot[Evaluate[Sin[# x]&/@{1,2,3,4,5}], {x,-Pi, Pi}, PlotLegends->"Expressions"] /. swap

Same picture


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.