Mercurial > hg > may
view yetilab/plot/plot.yeti @ 115:30c790d2789e
plot -> plotMatrix
author | Chris Cannam |
---|---|
date | Thu, 18 Apr 2013 08:47:26 +0100 |
parents | f73923903ba4 |
children | 098b4efde5b1 |
line wrap: on
line source
module yetilab.plot.plot; import org.jzy3d.plot3d.builder: Mapper; import org.jzy3d.maths: Range; import org.jzy3d.plot3d.primitives: Shape; import org.jzy3d.chart: Chart, ChartLauncher; import org.jzy3d.plot3d.builder: Builder; import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid; import org.jzy3d.colors.colormaps: ColorMapRainbow; import org.jzy3d.colors: ColorMapper; import org.jzy3d.colors: Color; import org.jzy3d.plot3d.rendering.canvas: Quality; newMatrixMapper matrix = (class MMapper extends Mapper double f(double x, double y) matrix.getAt y x end; new MMapper()); newMatrixLogMapper matrix = (class MMapper extends Mapper double f(double x, double y) ln (matrix.getAt y x) end; new MMapper()); newMapper mapFunction = (class FMapper extends Mapper double f(double x, double y) mapFunction x y end; new FMapper()); plotMatrix matrix = (mapper = newMatrixLogMapper matrix; size = matrix.size; xrange = new Range(1, size.columns - 1); yrange = new Range(1, size.rows - 1); grid = new OrthonormalGrid(xrange, size.columns, yrange, size.rows); println "Matrix size: \(size)"; surface = Builder#buildOrthonormalBig(grid, mapper); //??? big? surface#setFaceDisplayed(false); surface#setWireframeDisplayed(true); surface#setWireframeColor(Color#BLACK); // chart = new Chart(Quality#Fastest, "swing"); chart = new Chart(Quality#Nicest); chart#getScene()#getGraph()#add(surface); ChartLauncher#openChart(chart); ()); plotStructure structure = case structure of Grid matrix: plotMatrix matrix; //!!! _: failWith "Cannot plot this structure (only grids implemented so far)"; esac; { plotMatrix, plotStructure }