3
$\begingroup$

I am using the GreyLevel

  ContourPlot[-p1 Log[p1] - 
  p2 Log[p2] - (1 - p2 - p1) Log[(1 - p2 - p1)] + 
  Log[p1^2 + p2^2 + (1 - p2 - p1)^2], {p1, 0, 1}, {p2, 0, 1}, 
 PlotLegends -> Automatic, Contours -> 20, ColorFunction -> GrayLevel]

I get

enter image description here How can I change the black and white role? I want to reverse the black and white.

$\endgroup$
2
  • 1
    $\begingroup$ ColorFunction -> (GrayLevel[1 - #] &) $\endgroup$
    – cvgmt
    Aug 28 at 13:23
  • $\begingroup$ Thank you so much $\endgroup$
    – KarryMa
    Aug 28 at 13:25

1 Answer 1

10
$\begingroup$

Besides of ColorFunction -> (GrayLevel[1 - #] &), another way maybe ColorFunction -> ColorData[{"GrayTones", "Reverse"}]

ContourPlot[-p1 Log[p1] - 
  p2 Log[p2] - (1 - p2 - p1) Log[(1 - p2 - p1)] + 
  Log[p1^2 + p2^2 + (1 - p2 - p1)^2], {p1, 0, 1}, {p2, 0, 1}, 
 PlotLegends -> Automatic, Contours -> 20, 
 ColorFunction -> ColorData[{"GrayTones", "Reverse"}]]

enter image description here

$\endgroup$

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.