``` 1 # DataPoints. Interactive 3D plot with 2 sets of points. 2 3 from java.util import Random 4 from java.awt import Color 5 from jhplot import HPlot3D, P2D 6 7 c1 = HPlot3D("Canvas",600,400) 8 c1.setGTitle("Interactive 3D plot with 2 sets of points") 9 # define range in Xmin, Xmax, Ymin, Ymax, Zmin, Zmax 10 # if this range is not set, it will be set automatically 11 c1.setRange(-5,10,-5,5,-10,30) 12 c1.setNameX("X") 13 c1.setNameY("Y") 14 c1.visible(1) 15 16 17 18 # create random generator 19 rand = Random(); 20 21 # create P2D objects in 3D 22 h1= P2D("3D Gaussian 1") 23 h1.setSymbolSize(2); 24 h1.setSymbolColor(Color.blue); 25 26 for i in range(500): 27 x=1+rand.nextGaussian() 28 y=1+0.5*rand.nextGaussian() 29 z=10+4.5*rand.nextGaussian() 30 h1.add(x,y,z) 31 32 33 # create P2D objects in 3D 34 h2= P2D("3D Gaussian 2") 35 h2.setSymbolSize(4); 36 h2.setSymbolColor(Color.red); 37 38 for i in range(100): 39 x=2+2*rand.nextGaussian() 40 y=4+0.5*rand.nextGaussian() 41 z=6+1.5*rand.nextGaussian() 42 h2.add(x,y,z) 43 44 45 # draw them 46 c1.draw(h1) 47 c1.draw(h2) 48 49 50 # export to some image (png,eps,pdf,jpeg...) 51 # c1.export(Editor.DocMasterName()+".png") ### © jHepWork. S.Chekanov ### ```