I have a file with 2 columns of raw unbinned data, (x and y displacement). Each row in the file corresponds to a new time step. I would like to correlate the x and y displacements with each other.
For each row, I would like to bin the x-value and bin the y-value into histograms and then add one 'count' to the corresponding (x,y) bin.
I have a code that already does most of this, it bins each axis and then places a point/'count' in the corresponding space but the problem is that it doesn't add the 'counts' together. Instead, the points just overlap each other. You can kinda see how some of the points look bolder/darker than others where there are multiple points overlapping each other. Like so:
Gnuplot output with my full data set. Shows the bolder overlapping points
My question is: how can I get points/'counts' that are placed on top of each other, (like in my image), to be added together instead so that I can see where the areas of higher correlation are with a color map or something like this?
My gnuplot code that kinda does what I want it to do:
#!/usr/local/bin/gnuplot
set term postscript eps enhanced color
set encoding utf8
set offsets
set style fill solid
bin(x,width,min)=width*(floor((abs(x) - min)/width) + 0.5) + min
set output '2d.test.eps'
set palette defined (-1 "red", 0 "white", 1 "blue")
set cbrange [0:10]
binwidth=0.1
binwidth=0.1
xmin=-360
ymin=-360
set boxwidth binwidth*0.75
set view map
splot '2d.dat' using (bin($1,binwidth,xmin)):(bin($2,binwidth,ymin)):(1.0) not
Data file format:
0.864 3.868
1.878 3.617
0.138 2.787
0.646 3.220
-0.969 3.176
-0.447 3.031
-0.316 3.130
0.205 3.342
-1.127 3.661
-1.349 3.702
...