autogenerated by webify.pl on Mon Aug 26 08:39:20 2024 gnuplot version gnuplot 6.1 last modified 2024-08-25
#
# Demo for creating a heat map from scattered data points.
# Plot 1
# dgrid cheme "gauss kdensity" with unit weight (z=1)
# for each point yields a heat map of point density.
# The color indicates local point density.
# Plot 2
# Same scheme as plot 1 but using a finer grid
# Plot 3
# dgrid scheme "splines" uses measured z value of each
# point to fit a 3D surface that passes approximately
# through each point [x,y,z]. The color indicates the
# z value of this surface.
#
# Specify a 15 x 15 grid using "set dgrid".
# Each point contributes a Gaussian density component weighted
# by its distance from the grid point; i.e. grid boxes with
# more nearby points receive a higher value.
# Note: Many other weighting schemes are possible.
#
unset key
set view map
set tmargin 4
set palette cubehelix negative
set tics scale 0
set xtics 10
set ytics 10
set xrange noextend
set yrange noextend
set border 31
set label 1 "Heat map of point density " font ":Bold"
set label 2 "set dgrid 15,15 gauss kdensity 3, 3"
set label 3 "assign all points equal weight"
set label 1 center front at screen 0.5, 0.93
set label 2 center front at screen 0.5, 0.87
set label 3 center front at screen 0.5, 0.82
set label 4 center at graph 1.1, 1.1 "Score"
set dgrid 15,15 gauss kdensity 3, 3
splot 'mask_pm3d.dat' using 1:2:(1) with pm3d, \
'' using 1:2:(1) with points lc "black" pt 7 ps 0.6 nogrid
Click here for minimal script to generate this plot
#
# Same data, same weighting, finer grid
#
set dgrid 25,25 gauss kdensity 3, 3
set label 2 "set dgrid 25,25 gauss kdensity 3, 3"
replot
Click here for minimal script to generate this plot
#
# Heat map of surface z value after fitting splines to points
#
set multiplot
set label 1 "Heat map of surface fit" font ":Bold"
set label 2 "set dgrid splines"
set label 3 ""
set label 4 "Z value"
set dgrid splines
splot 'mask_pm3d.dat' using 1:2:3 with pm3d, \
'' using 1:2:3 with points lc "black" pt 7 ps 0.6 nogrid
# Inset subfigure showing surface in 3D
set origin 0.0,.65
set margin -1, 0, screen 0.72, screen 0.9
# set margin -1, 0, 0, 0
set size 0.3, 0.3
clear
set view
set xyplane at -500
set zrange [-500:500]
unset tics
set border 15
unset for [i=1:4] label i
set title "gridded surface fit to points"
splot 'mask_pm3d.dat' using 1:2:3 with lines lc "cyan", \
'' using 1:2:3 with points lc "black" pt 7 ps 0.3 nogrid
unset multiplot
Click here for minimal script to generate this plot