Bug introduced in 10.0 and fixed in

My minimal working example is the code

ArrayPlot[{{1, 0.1, 0}, {0.1, 0, 0}}, PlotLegends -> Automatic]

The plot legend shows up as a bar legend, but the colors in the legend are inconsistent with what is shown in the array plot.

Here is the plot:

enter image description here

but here is the the plot legend that is generated along with it.

enter image description here

You can see white and black seem to be reversed from what they should be. Here as some related questions: Bar legend coloring doesn't correspond to array plot coloring in the expected way, and MatrixPlot provides wildly inaccurate PlotLegend?

My question is: Why is Mathematica doing this, and how can I fix it? (I am running version


This looks like a bug. Please report it to Wolfram Support.

A simple workaround is to specify your own colour function.

ArrayPlot[{{1, 0.1, 0}, {0.1, 0, 0}}, PlotLegends -> Automatic, 
 ColorFunction -> (GrayLevel[1 - #] &)]

enter image description here

  • $\begingroup$ Ok, I reported it. I guess I will maybe put an update in the question if anything happens. $\endgroup$ – Brian Moths Jun 16 '16 at 19:44
  • $\begingroup$ @NowIGetToLearnWhatAHeadIs Thank you! $\endgroup$ – Szabolcs Jun 16 '16 at 19:46

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.