Showing two functions with colors
Code: "func1.py". Programming language: Python DMelt Version 1.4. Last modified: 12/06/1970. License: Pro
https://datamelt.org/code/cache/func1_5184.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 *

# first function
f1 = F1D("2*exp(-x*x/50)+sin(pi*x)/x", 1.0, 10.0)
f1.setPenDash(4)

# second function
f2 = F1D("exp(-x*x/50)+pi*x", 1.0, 10.0)
f2.setColor(Color.green)
f2.setPenWidth(1)

# build a canvas with X and Y titles
c1 = HPlot("Canvas")
c1.setGTitle("2 functions", Color.red)
c1.setMarginLeft(90)
c1.setNameX("X")
c1.setNameY("Y")
c1.visible()
c1.setAutoRange()

c1.draw(f1)
c1.draw(f2)


You see the box below because you did not login.