Small but annoying bug in PlotLegends/ListContourPlot

The following code:

grid1 = ConstantArray[0.0, {8, 8}];
ListContourPlot[grid1,
 PlotLegends -> Automatic
 ]

…produces a blank plot, as it should, but throws an error MapThread is not a Graphics primitive or directive. when attempting to produce a legend. The problem, obviously, is that there’s no variation in the data. Of course I can work around this, with something like:

Block[{range},
 range = Max[grid1] - Min[grid1];
 ListContourPlot[grid1,
  PlotLegends -> If[range <= 0.0, None, Automatic]
  ]
 ]

…but it would be nice if Mathematica 10 handled the edge case gracefully. Mathematica 9 did.

1 Like

Thank you for posting this. I sent the information to support@wolfram.com for reporting.

1 Like