 |
A function (F1D) converted to two custom histograms (H1D)
Source code name: "func1_histo2.py"
Programming language: Python
Topic: Function/1D
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/func1_histo2_3727.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.awt import Color
from jhplot import HPlot,F1D
c1 = HPlot("Canvas")
c1.setGTitle("Converting hto histogram", Color.red)
c1.setNameX("X")
c1.setNameY("Y")
c1.visible(1)
c1.setAutoRange()
f1 = F1D("2*exp(-x*x/50)+sin(pi*x)/x", -2.0, 5.0)
c1.draw(f1)
h=f1.getH1D("Histogram 1",500,1,5)
h.setColor(Color.red)
h.setFill(1)
h.setFillColor(Color.red)
c1.draw(h)
h1=f1.getH1D("Histogram 2",10,-2,-0.5)
h1.setColor(Color.blue)
h1.setFill(1)
h1.setFillColor(Color.blue)
c1.draw(h1)
# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMaster
You see the box below because you did not login.