5
$\begingroup$

I'm using ListContourPlot with InterpolationOrder -> 0 to plot some data and end up with some seemingly random white triangles:

res = {{0,0.01,0},{0,0.03,0},{0,0.05,0},{0,0.07,0},{0,0.09,0},{0,0.11,0},{0,0.13,0},{0,0.15,0},{0,0.17,0},{0,0.19,0},{0,0.21,0},{0,0.23,0},{0,0.25,0},{0,0.27,0},{0,0.29,0},{0,0.31,0},{0,0.33,0},{0,0.35,0.00130814},{0,0.37,0.00331164},{0,0.39,0.00737524},{0,0.41,0.0144195},{0,0.43,0.0247061},{0,0.45,0.0370453},{0,0.47,0.0485595},{0,0.49,0.055606},{0,0.51,0.055606},{0,0.53,0.0485595},{0,0.55,0.0370453},{0,0.57,0.0247061},{0,0.59,0.0144195},{0,0.61,0.00737524},{0,0.63,0.00331164},{0,0.65,0.00130814},{0,0.67,0},{0,0.69,0},{0,0.71,0},{0,0.73,0},{0,0.75,0},{0,0.77,0},{0,0.79,0},{0,0.81,0},{0,0.83,0},{0,0.85,0},{0,0.87,0},{0,0.89,0},{0,0.91,0},{0,0.93,0},{0,0.95,0},{0,0.97,0},{0,0.99,0},{0.02,0.01,0},{0.02,0.03,0},{0.02,0.05,0},{0.02,0.07,0},{0.02,0.09,0},{0.02,0.11,0},{0.02,0.13,0},{0.02,0.15,0},{0.02,0.17,0},{0.02,0.19,0},{0.02,0.21,0},{0.02,0.23,0},{0.02,0.25,0},{0.02,0.27,0},{0.02,0.29,0},{0.02,0.31,0},{0.02,0.33,0},{0.02,0.35,0.00160089},{0.02,0.37,0.0038474},{0.02,0.39,0.00819232},{0.02,0.41,0.0154255},{0.02,0.43,0.0256423},{0.02,0.45,0.0375832},{0.02,0.47,0.0485203},{0.02,0.49,0.0551391},{0.02,0.51,0.0551391},{0.02,0.53,0.0485203},{0.02,0.55,0.0375832},{0.02,0.57,0.0256423},{0.02,0.59,0.0154255},{0.02,0.61,0.00819232},{0.02,0.63,0.0038474},{0.02,0.65,0.00160089},{0.02,0.67,0},{0.02,0.69,0},{0.02,0.71,0},{0.02,0.73,0},{0.02,0.75,0},{0.02,0.77,0},{0.02,0.79,0},{0.02,0.81,0},{0.02,0.83,0},{0.02,0.85,0},{0.02,0.87,0},{0.02,0.89,0},{0.02,0.91,0},{0.02,0.93,0},{0.02,0.95,0},{0.02,0.97,0},{0.02,0.99,0},{0.04,0.01,0},{0.04,0.03,0},{0.04,0.05,0},{0.04,0.07,0},{0.04,0.09,0},{0.04,0.11,0},{0.04,0.13,0},{0.04,0.15,0},{0.04,0.17,0},{0.04,0.19,0},{0.04,0.21,0},{0.04,0.23,0},{0.04,0.25,0},{0.04,0.27,0},{0.04,0.29,0},{0.04,0.31,0},{0.04,0.33,0},{0.04,0.35,0.00193285},{0.04,0.37,0.0044244},{0.04,0.39,0.00903305},{0.04,0.41,0.0164194},{0.04,0.43,0.0265318},{0.04,0.45,0.0380659},{0.04,0.47,0.0484474},{0.04,0.49,0.0546643},{0.04,0.51,0.0546643},{0.04,0.53,0.0484474},{0.04,0.55,0.0380659},{0.04,0.57,0.0265318},{0.04,0.59,0.0164194},{0.04,0.61,0.00903305},{0.04,0.63,0.0044244},{0.04,0.65,0.00193285},{0.04,0.67,0},{0.04,0.69,0},{0.04,0.71,0},{0.04,0.73,0},{0.04,0.75,0},{0.04,0.77,0},{0.04,0.79,0},{0.04,0.81,0},{0.04,0.83,0},{0.04,0.85,0},{0.04,0.87,0},{0.04,0.89,0},{0.04,0.91,0},{0.04,0.93,0},{0.04,0.95,0},{0.04,0.97,0},{0.04,0.99,0},{0.06,0.01,0},{0.06,0.03,0},{0.06,0.05,0},{0.06,0.07,0},{0.06,0.09,0},{0.06,0.11,0},{0.06,0.13,0},{0.06,0.15,0},{0.06,0.17,0},{0.06,0.19,0},{0.06,0.21,0},{0.06,0.23,0},{0.06,0.25,0},{0.06,0.27,0},{0.06,0.29,0},{0.06,0.31,0},{0.06,0.33,0},{0.06,0.35,0.00230473},{0.06,0.37,0.00504018},{0.06,0.39,0.00989243},{0.06,0.41,0.0173967},{0.06,0.43,0.0273736},{0.06,0.45,0.0384954},{0.06,0.47,0.0483427},{0.06,0.49,0.0541818},{0.06,0.51,0.0541818},{0.06,0.53,0.0483427},{0.06,0.55,0.0384954},{0.06,0.57,0.0273736},{0.06,0.59,0.0173967},{0.06,0.61,0.00989243},{0.06,0.63,0.00504018},{0.06,0.65,0.00230473},{0.06,0.67,0},{0.06,0.69,0},{0.06,0.71,0},{0.06,0.73,0},{0.06,0.75,0},{0.06,0.77,0},{0.06,0.79,0},{0.06,0.81,0},{0.06,0.83,0},{0.06,0.85,0},{0.06,0.87,0},{0.06,0.89,0},{0.06,0.91,0},{0.06,0.93,0},{0.06,0.95,0},{0.06,0.97,0},{0.06,0.99,0}};

ListDensityPlot[res, InterpolationOrder -> 0]

Mathematica graphics

Any idea on how to get rid of them? PlotRange -> All doesn't help.

$Version
(* 12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019) *)

Update: I fired up some older versions and found no problem in 10.0-11.3, so I've reported this to WRI.

$\endgroup$
  • 1
    $\begingroup$ To quote Henny Youngman: "If it hurts when you do that, don't do that." InterpolationOrder->None doesn't have the white triangles. $\endgroup$ – JimB Sep 3 at 4:01
  • 2
    $\begingroup$ But InterpolationOrder->None does something else ... As far as I can tell, this is a bug. Did you report it? Possible workaround: Since your points are on a regular grid, they could be arranged into a matrix and plotted with a simpler ArrayPlot instead. $\endgroup$ – Szabolcs Sep 3 at 6:57
  • 1
    $\begingroup$ Yes, InterpolatationOrder->None does actually interpolate the same way as InterpolationOrder->1, see ImageDifference[ ListDensityPlot[res, InterpolationOrder -> None, PlotRange -> Full], ListDensityPlot[res, InterpolationOrder -> 1, PlotRange -> Full]] The ArrayPlot solution can work ArrayPlot[Transpose@ArrayReshape[res[[;; , 3]], {4, 50}], AspectRatio -> 1, ColorFunction -> "Rainbow"] $\endgroup$ – Ihor Sep 3 at 7:17
  • 4
    $\begingroup$ Definite duplicate of mathematica.stackexchange.com/questions/195515/…. It looks like it has already been reported to Wolfram Support, so hopefully they've had a head start in addressing it. $\endgroup$ – user6014 Sep 3 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.