Search code examples
graphgnuplot

dgrid3d and multiple z-values


I'm a beginner and this may be a silly question.

I wonder if I'm plotting a graph using dgird3d when having multiple z-values for the same x, y pair, what z-value (or all values or some kind of average) will be used when computing the weighted distances between the generated grid point and actual the data point (in this case multiple for same x, y)? I'm referring to the this documentation paragraph (but not necessarily qnorm related):

The qnorm algorithm calculates a weighted average of the input data at each grid point. Each data point is weighted inversely by its distance from the grid point raised to the norm power.


Solution

  • Maybe it is mentioned somewhere in the documentation, but I haven't found it as well. But you can test it yourself. It's no proof, but an indication that gnuplot takes the average if you have several z-values for identical x,y values. In the example below, the z-value is (25+0+50)/3. = 25. Unfortunately, it seems that you cannot (yet) plot/print the interpolated data to a table to see the actual numerical value.

    Script:

    ### dgrid3d z-value of several identical x,y values
    reset session
    
    $Data <<EOD
     0     0      8
     0     1     10
     1     0      9
     1     1     11
     0.5   0.5   25
     0.5   0.5    0
     0.5   0.5   50
    EOD
    
    set dgrid3d 100,100 qnorm
    set view map
    set size ratio -1 
    
    splot $Data u 1:2:3 w pm3d
    ### end of script
    

    Result:

    enter image description here