# ListDensityPlot problem

I use the following data

data3 = {{3 , 1, 1}, {18, 1, 2 }, {3 , 3, 4 }, {18 , 3, 3}}
ListDensityPlot[data3, InterpolationOrder -> 0]


when I multiplied x values to $$10^{6}$$ I get the wrong picture.

data3 = {{3  10^6, 1, 1}, {18  10^6, 1, 2 }, {3  10^6 , 3, 4 }, {18  10^6, 3, 3}}
ListDensityPlot[data3, InterpolationOrder -> 0]


Why it this happening and how to fix it?

• try ListDensityPlot[data3, InterpolationOrder -> 0, ScalingFunctions -> {{# 10^-6 &, # 10^6 &}, "Linear"}]?
– kglr
Commented Apr 15, 2020 at 12:38

When x and y coordinates have vastly different scales, plot functions can give unexpected results (see also: ListPlot3D weirdly distorts and loses plotting data).

A work-around is to use the option ScalingFunctions to make the x and y scales close to each other.

data3 = {{3 10^6, 1, 1}, {18 10^6, 1, 2}, {3 10^6, 3, 4}, {18 10^6, 3, 3}};

ListDensityPlot[data3, InterpolationOrder -> 0,
ScalingFunctions -> {{# 10^-6 &, # 10^6 &}, "Linear"}]


Alternatively,

ListDensityPlot[data3, InterpolationOrder -> 0,
ScalingFunctions -> { "Linear", {# 10^6 &, # 10^-6 &}}]