``` 1 # Canvas3D example. Using HPlot3DS canvas to show functions in 3D 2 3 from java.awt import Color 4 from jhplot import * 5 6 c1 = HPlot3DP("Canvas",600,600,2,1) 7 c1.setGTitle('3D surfaces') 8 c1.visible() 9 10 f1=FPR('u=2*Pi*u; x=cos(u); y=sin(u); z=v') 11 # set color with transparency 12 c=Color(0.5,0.2,0.5,0.5) 13 f1.setFillColor(c) 14 f1.setLineColor(Color.green) 15 16 f2=FPR('u=2 Pi u; v=2 Pi v; r=0.6+.2cos(u); z=.8 sin(u); x=r cos(v); y=r sin(v)') 17 f2.setFillColor(Color.blue) 18 f2.setFilled(0) 19 20 c1.setFov(10) 21 c1.setFog(0) 22 c1.setAxes(0) 23 c1.setNameX("X axis") 24 c1.setNameY("Y axis") 25 c1.setAxesColor(Color.white) 26 c1.setAxes(1,1,0) 27 c1.setAxesArrows(0) 28 c1.setRangeZ(0,20) 29 c1.setBackgColor(Color.yellow) 30 31 print c1.getCameraPosition() 32 c1.setCameraPosition(-2.0) 33 c1.draw(f2) 34 c1.draw(f1) 35 36 c1.cd(2,1) 37 c1.setFog(0) 38 f3=FPR('r=0.7; u=2 Pi u; v=Pi v; \ x=r cos(u) sin(v); y=r sin(u) sin(v); z=r cos(v)') 40 f3.setDivisions(30,30) 41 f3.setLineColor(Color.yellow) 42 print c1.getEyePosition() 43 c1.setCameraPosition(-0.2) 44 45 c1.draw(f3) ### © jHepWork. S.Chekanov ### ```