annotate yetilab/plot/plot.yeti @ 110:f039eec93d50

Add lookups for known (but not installed) plugins to vamp module
author Chris Cannam
date Sat, 13 Apr 2013 22:00:09 +0100
parents 8f6c2f87dc35
children 90dca6156662
rev   line source
Chris@108 1 module yetilab.plot.plot;
Chris@108 2
Chris@108 3 import org.jzy3d.plot3d.builder: Mapper;
Chris@108 4 import org.jzy3d.maths: Range;
Chris@108 5 import org.jzy3d.plot3d.primitives: Shape;
Chris@108 6 import org.jzy3d.chart: Chart, ChartLauncher;
Chris@108 7 import org.jzy3d.plot3d.builder: Builder;
Chris@108 8 import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid;
Chris@108 9 import org.jzy3d.colors.colormaps: ColorMapRainbow;
Chris@108 10 import org.jzy3d.colors: ColorMapper;
Chris@108 11 import org.jzy3d.colors: Color;
Chris@108 12 import org.jzy3d.plot3d.rendering.canvas: Quality;
Chris@108 13
Chris@108 14 newMatrixMapper matrix =
Chris@108 15 (class MMapper extends Mapper
Chris@108 16 double f(double x, double y)
Chris@108 17 matrix.getAt y x
Chris@108 18 end;
Chris@108 19 new MMapper());
Chris@108 20
Chris@108 21 newMatrixLogMapper matrix =
Chris@108 22 (class MMapper extends Mapper
Chris@108 23 double f(double x, double y)
Chris@108 24 ln (matrix.getAt y x)
Chris@108 25 end;
Chris@108 26 new MMapper());
Chris@108 27
Chris@108 28 newMapper mapFunction =
Chris@108 29 (class FMapper extends Mapper
Chris@108 30 double f(double x, double y)
Chris@108 31 mapFunction x y
Chris@108 32 end;
Chris@108 33 new FMapper());
Chris@108 34
Chris@108 35 plot matrix =
Chris@108 36 (mapper = newMatrixLogMapper matrix;
Chris@108 37 size = matrix.size;
Chris@108 38 xrange = new Range(1, size.columns - 1);
Chris@108 39 yrange = new Range(1, size.rows - 1);
Chris@108 40 grid = new OrthonormalGrid(xrange, size.columns, yrange, size.rows);
Chris@110 41 surface = Builder#buildOrthonormalBig(grid, mapper); //??? big?
Chris@108 42 surface#setFaceDisplayed(true);
Chris@108 43 surface#setWireframeDisplayed(true);
Chris@108 44 surface#setWireframeColor(Color#BLACK);
Chris@108 45 chart = new Chart(Quality#Nicest);
Chris@108 46 chart#getScene()#getGraph()#add(surface);
Chris@108 47 ChartLauncher#openChart(chart));
Chris@108 48
Chris@110 49 plotStructure structure =
Chris@110 50 case structure of
Chris@110 51 Grid matrix:
Chris@110 52 plot matrix;
Chris@110 53 //!!!
Chris@110 54 _: failWith "Cannot plot this structure (only grids implemented so far)";
Chris@110 55 esac;
Chris@108 56
Chris@110 57 { plot, plotStructure }
Chris@110 58