Plotting X-Y using polar coordinates
Code: "canvas2D_polar2_waterloo.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_polar2_waterloo_2694.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 GJGraphContainer
from kcl.waterloo.graphics import GJGraph
from kcl.waterloo.graphics.plots2D import GJPlotInterface
from kcl.waterloo.graphics.plots2D import GJPolarStem

f=GCFrame("Polar plot")
gc=GJGraphContainer.createInstance(GJGraph.createInstance())
f.add(gc)

x=[]
y=[]
for i in range(-100,10,5):
      x.append(i)
      y.append(i*i*2)

p=GJPolarStem.createInstance()
p.setXData(x)
p.setYData(y)

gc.getView().add(p)
gc.getView().autoScale()


from kcl.waterloo.export import ExportFactory
from java.io import File
ExportFactory.saveAsSVG(gc, File("canvas2D_polar2_waterloo.svg"));

You see the box below because you did not login.