Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a problem with ListDensityPlot. I have some data on an irregular grid.

I try to plot them with

xStart=0;
xEnd=1000;
yStart=170;
yEnd=270;
ListDensityPlot[data,PlotRange -> {{xStart, xEnd}, {yStart, yEnd}}, FrameTicks -> True, 
AspectRatio -> Abs[(yEnd - yStart)/(xEnd - xStart)], PlotRangePadding -> None,   
ColorFunction -> (If[#1 === 0 , Black, GrayLevel[Rescale[#1, {0, 1}]]] &), 
ColorFunctionScaling -> False, LightingAngle -> None, InterpolationOrder -> 0, ImageSize -> 1000]

In the output I have some ugly white spots: picture with white spots

If I change my plot (setting xEnd = 230), the white spots disappear: picture with reduced range

So, from my point of view, the white spots are not caused by my data. Somehow Mathematica (I am using 9.0.1) causes them.

To solve this problem I am using the following workaround:

ListPlot3D[data, PlotRange -> {{xStart, xEnd/1}, {yStart, yEnd}, All}, 
BoxRatios -> {1, Abs[(yEnd - yStart)/(xEnd - xStart)], 1}, 
ColorFunction -> (If[#1 === 0 , Black, GrayLevel[Rescale[#3, {0, 1}]]] &), 
ColorFunctionScaling -> True,Mesh -> None, ImageSize -> 1500, 
ViewPoint -> {0, 0, Infinity}, InterpolationOrder -> 0, BoundaryStyle -> None]

This gives me a nice output: picture without white spots

What can I do that I get the same output with ListDensityPlot? At least I need ListDensityPlot because changes in the InterpolationOrder look there different than in the ListPlot3D.

There is perhaps a similar question here, but rescaling does not help here. Additionally, my problem is “solved” with ListPlot3D, Eli Lansey’s problem not.

I would be happy about some help!

share|improve this question
2  
Looks like it might be clipping. Try PlotRange -> {{xStart, xEnd}, {yStart, yEnd}, All} –  Michael E2 Jun 13 '13 at 14:30
    
1000 scores for you!! This is the solution! Please type this as answer, so that I can give you at least one score! How shall somebody have the idea to use 3 options in PlotRange for a 2-dimensional plot? As far as I know there is nothing about this trick in the help about ListDensityPlot. Anyway, thanks a lot! –  partial81 Jun 13 '13 at 14:47

1 Answer 1

up vote 4 down vote accepted

The white generally indicates plot range clipping. See ListDensityPlot, the ClippingStyle and PlotRange sections.

Setting

PlotRange -> {{xStart, xEnd}, {yStart, yEnd}, All}

will include all data values. If the data has a few extreme values, including the whole range will flatten out smaller variations in the data.

share|improve this answer
    
Thanks again for this solution. I know ClippingStyle, but that you can get rid of this feature by your trick is new for me. Actually, this trick should be mentioned in Mathematica`s help (or I have overseen it). Anyway, you helped me a lot! –  partial81 Jun 13 '13 at 15:27
    
@partial81 I think the examples in the "PlotRange" section (under "Options") of ListDensityPlot is trying to show this trick. I admit that at first glance, it's hard to see because the default color scheme ends at "white." Try them with ColorFunction -> "Rainbow". (Also I mistyped the link in my answer -- fixed now.) –  Michael E2 Jun 13 '13 at 16:00
    
You are right! And this trick is well hidden. Thanks for the fix and the explanation! –  partial81 Jun 13 '13 at 16:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.