annotate scraps/plot2.yeti @ 150:e65bdec6470e

Add plotSeries, switch to jline2
author Chris Cannam
date Mon, 29 Apr 2013 17:24:54 +0100
parents 098b4efde5b1
children
rev   line source
Chris@108 1 module scraps.plot2;
Chris@107 2
Chris@107 3 import org.jzy3d.plot3d.builder: Mapper;
Chris@107 4 import org.jzy3d.maths: Range;
Chris@107 5 import org.jzy3d.plot3d.primitives: Shape;
Chris@107 6 import org.jzy3d.chart: Chart, ChartLauncher;
Chris@107 7 import org.jzy3d.plot3d.builder: Builder;
Chris@107 8 import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid;
Chris@107 9 import org.jzy3d.colors.colormaps: ColorMapRainbow;
Chris@107 10 import org.jzy3d.colors: ColorMapper;
Chris@107 11 import org.jzy3d.colors: Color;
Chris@107 12 import org.jzy3d.plot3d.rendering.canvas: Quality;
Chris@107 13
Chris@107 14 newMapper mapFunction =
Chris@107 15 (class YMapper extends Mapper
Chris@107 16 double f(double x, double y)
Chris@107 17 mapFunction x y
Chris@107 18 end;
Chris@107 19 new YMapper());
Chris@107 20
Chris@107 21 range = new Range(-150, 150);
Chris@107 22 steps = 50;
Chris@107 23
Chris@107 24 mapper = newMapper do x y: 10 * sin(x / 10) * cos(y / 20) * x done;
Chris@107 25
Chris@107 26 surface = Builder#buildOrthonormal(new OrthonormalGrid(range, steps, range, steps), mapper);
Chris@107 27 surface#setColorMapper(new ColorMapper(new ColorMapRainbow(), surface#getBounds()#getZmin(), surface#getBounds()#getZmax(), new Color(1, 1, 1, 0.5)));
Chris@107 28 surface#setFaceDisplayed(true);
Chris@107 29 surface#setWireframeDisplayed(false);
Chris@107 30 surface#setWireframeColor(Color#BLACK);
Chris@107 31
Chris@117 32 println "Z Bounds: \(surface#getBounds()#getZmin()) -> \(surface#getBounds()#getZmax())";
Chris@117 33
Chris@108 34 chart = new Chart(Quality#Nicest);
Chris@107 35 chart#getScene()#getGraph()#add(surface);
Chris@107 36 ChartLauncher#openChart(chart);
Chris@107 37