 |
HPlotXYZ shows function and points in 3D
Source code name: "canvas3D_hplotXYZ.py"
Programming language: Python
Topic: Plots/3D
DMelt Version 1.5. Last modified: 05/18/2016. License: Pro
https://datamelt.org/code/cache/canvas3D_hplotXYZ_4747.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 jhplot import *
from java.awt import Color
from java.util import Random
c1=HPlotXYZ("3D",600,400,2,1)
c1.setGTitle("Math objects in 3D")
c1.setNameX("X axis")
c1.setNameX("Y axis")
c1.visible()
c1.setTickDecimalAll(1)
h1 = P2D("Simple1")
h2 = P2D("Simple2")
hh=H2D("Histogram",10,-2,2,10,-2,2)
rand = Random()
for i in range(100):
h1.add(rand.nextGaussian(),rand.nextGaussian(),rand.nextGaussian())
h2.add(0.2*rand.nextGaussian(),rand.nextGaussian(),rand.nextGaussian())
for i in range(1000):
hh.fill(rand.nextGaussian(),rand.nextGaussian())
f=F2D("x*sin(y)",-2,2,-2,2)
c1.add(h1,10,Color.red)
c1.add(h2,3,Color.blue)
c1.add(f)
c1.update()
c1.cd(2,1)
c1.setTickDecimalAll(1)
f=F2D("x*x+y*y",-2,2,-2,2)
c1.add(f)
c1.add(hh)
c1.setColorSolid(0)
c1.addAsBars(hh)
c1.update()
You see the box below because you did not login.