3

I am trying to make a density plot to show the data that can found here. I tried with GNUplot previously. The result of GNUplot density plot for a rectangular set of data. I am able to do this only for a square (n x n) data set of the type:

x_1, y_1, z_1
...
x_n, y_n, z_n

where n is the number of lines.

The file that I post here is different. It is more similar to the one in the example from ListLinePlot page, which shows how to make a density plot for a spherical distribution of numbers.

Now the question is: Can I make the density plot of this data set with listdensityplot in Mathematica? The 2D map of the x-y is like that 2D map and the 3D map. As You can see all the points are in particular regions of the plot. So I expect that the density map works only in this part of the space (something simliar to this link Spreading colors in ListDensityPlot)

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574

2 Answers2

5
d = Import["https://federico.bitrix24.com/docs/pub/10347a058a3a38a8bd8232155c080e51/?LoadFile=1"];

Using 2D binning code from that great topic it is quite fast to obtain what you need:

zvalues = Log10@d[[All, 3]];
epsilon = 1*^-10;
indexes = 1 + Floor[(1 - epsilon) 512 Rescale[d[[All, {1, 2}]]]];
System`SetSystemOptions[
              "SparseArrayOptions" -> {"TreatRepeatedEntries" -> (Total[{##}] &)}];
binmeansZ = SparseArray[indexes -> zvalues];
System`SetSystemOptions[
              "SparseArrayOptions" -> {"TreatRepeatedEntries" -> First}];


MatrixPlot[GaussianFilter[binmeansZ\[Transpose], 2], DataRange -> {{-2, 2}, {-2, 2}}]

enter image description here

Kuba
  • 136,707
  • 13
  • 279
  • 740
4

The example that you showed makes it clear that the plot should use a logarithmic scale. So after importing your data as a list called d, I rescale them as follows:

rescaled = {#1, #2, Log[#3]} & @@@ d;

ListDensityPlot[rescaled, InterpolationOrder -> 0, PlotRange -> All, 
 ColorFunction -> Hue]

plot

There seem to be some data missing, and the plot takes a minute or so because it is very large.

Jens
  • 97,245
  • 7
  • 213
  • 499