``` 1 # DataPoints. Using P1D data holder. Data manipulations 2 # Note: get weighted average 3 4 from java.awt import Color,Font 5 from java.util import Random 6 from jhplot import HPlot,P1D 7 from math import sqrt; 8 9 c1 = HPlot("Canvas",600,400,2, 1) 10 c1.visible(1) 11 c1.setAutoRange() 12 13 # keep 2 sets of the data 14 data=[]; 15 16 c1.setGTitle("Average of experimental data", Color.blue) #put title 17 c1.viewHisto(0) # make sure starts from 0 18 19 # fill first data set 20 p1= P1D("data1") 21 p1.add(10,100,5,5) 22 p1.add(20,50,5,5) 23 p1.add(30,80,5,5) 24 c1.draw(p1) 25 26 27 # fill second data set 28 p2= P1D("data2") 29 p2.add(10,40,5,5) 30 p2.add(20,40,5,5) 31 p2.add(30,40,5,5) 32 data.append(p2) 33 c1.draw(p2) 34 35 36 # fill 3rd data set 37 p3= P1D("data3") 38 p3.add(10,50,5,5) 39 p3.add(20,45,5,5) 40 p3.add(30,20,5,5) 41 data.append(p3) 42 c1.draw(p3) 43 44 # add p2,p3 to p1 using weighted average 45 p4=p1.addAndAverage(data) 46 p4.setTitle("Weighted Average") 47 p4.setColor(Color.blue) 48 49 50 # show points with statistical errors in y 51 c1.cd(2,1) 52 c1.setAutoRange() 53 c1.draw(p4) ### © jHepWork. S.Chekanov ### ```