Show X-Y-Z data in 3D (P2D) as a surface
Code: "p2d_surf.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/p2d_surf_2114.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



from java.util import Random
from jhplot  import *

# build a standard 3D canvas
c1 = HPlot3D("Canvas")
c1.setGTitle("Global title")
c1.setNameX("X")
c1.setNameY("Y")
c1.visible(1)

pp=P2D("X-Y-Z")
pp.add(1000,13,75.2)
pp.add(1000,21,79.21)
pp.add(1000,29,80.02)
pp.add(5000, 29,87.9)
pp.add(5000, 37,88.54)
pp.add(5000, 45,88.56)
pp.add(10000,29,90.11)
pp.add(10000,37,90.79)
pp.add(10000,45,90.87)


# we fill histogram now. Z value is a weight for a histogram channel
h1 = H2D("2D histogram",50,900.0,11000,50,0.0,100.0)
for i in range(pp.size()):
    h1.fill(pp.getX(i),pp.getY(i),pp.getZ(i))
    
c1.setSurface()
c1.draw(h1)

You see the box below because you did not login.