Plotting X-Y using Waterloo scientific library
Code: "canvas2D_points_waterloo.py". Programming language: Python
DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_points_waterloo_3273.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.
# This example shows how to plot X-Y using Waterloo scientific library
from kcl.waterloo.swing import GCFrame
from kcl.waterloo.graphics import GJGraph,GJGraphContainer
from kcl.waterloo.graphics.plots2D import GJScatter,GJPlotInterface
f=GCFrame("Scatter plot")
gc=GJGraphContainer.createInstance(GJGraph.createInstance())
f.add(gc)
x=[]
y=[]
for i in range(-100,100,5):
x.append(i)
y.append(i*i)
p=GJScatter.createInstance()
p.setXData(x)
p.setYData(y)
gc.getView().add(p)
gc.getView().autoScale()
print "Creating SVG image.."
from kcl.waterloo.export import ExportFactory
from java.io import File
ExportFactory.saveAsSVG(gc, File("canvas2D_points_waterloo.svg"))
You see the box below because you did not login.