comparison yetilab/plot/plot.yeti @ 131:70eaf374a1b5

Make charts non-animated; add a list of nice colours
author Chris Cannam
date Mon, 22 Apr 2013 10:24:44 +0100
parents aef0fbc65f16
children f268b2982ed4
comparison
equal deleted inserted replaced
130:aef0fbc65f16 131:70eaf374a1b5
11 import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid; 11 import org.jzy3d.plot3d.builder.concrete: OrthonormalGrid;
12 import org.jzy3d.colors.colormaps: ColorMapRainbow; 12 import org.jzy3d.colors.colormaps: ColorMapRainbow;
13 import org.jzy3d.colors: ColorMapper, Color; 13 import org.jzy3d.colors: ColorMapper, Color;
14 import org.jzy3d.plot3d.rendering.canvas: Quality; 14 import org.jzy3d.plot3d.rendering.canvas: Quality;
15 import org.jzy3d.plot3d.rendering.view.modes: ViewPositionMode; 15 import org.jzy3d.plot3d.rendering.view.modes: ViewPositionMode;
16
17 chartColours = [
18 new Color(161, 54, 2), // red
19 new Color(207, 228, 148), // grey-green
20 new Color(82, 126, 154), // dark steel blue
21 new Color(251, 116, 43), // light red
22 new Color(126, 33, 28), // dried blood!
23 new Color(21, 183, 197), // light blue
24 new Color(188, 13, 207), // mid purple
25 new Color(200, 125, 234), // light purple
26 ];
16 27
17 newMatrixMapper matrix = 28 newMatrixMapper matrix =
18 (class MMapper extends Mapper 29 (class MMapper extends Mapper
19 double f(double x, double y) 30 double f(double x, double y)
20 result = matrix.getAt y x; 31 result = matrix.getAt y x;
54 chart#getScene()#getGraph()#add(surface); 65 chart#getScene()#getGraph()#add(surface);
55 ChartLauncher#openChart(chart); 66 ChartLauncher#openChart(chart);
56 ()); 67 ());
57 68
58 plotBarChart keys unit values = 69 plotBarChart keys unit values =
59 (chart = new Chart(Quality#Nicest); 70 (quality = Quality#Nicest;
71 quality#setAnimated(false);
72 chart = new Chart(quality);
60 var n = 0; 73 var n = 0;
61 scene = chart#getScene(); 74 scene = chart#getScene();
62 ticks = new float[length keys]; 75 ticks = new float[length keys];
63 tickLabels = new TickLabelMap(); 76 tickLabels = new TickLabelMap();
64 for keys do k: 77 for keys do k:
81 axes#setYTickLabelDisplayed(false); 94 axes#setYTickLabelDisplayed(false);
82 ChartLauncher#openChart(chart); 95 ChartLauncher#openChart(chart);
83 ()); 96 ());
84 97
85 plotLines xkeys unit values = 98 plotLines xkeys unit values =
86 (chart = new Chart(Quality#Nicest); 99 (quality = Quality#Nicest;
100 quality#setAnimated(false);
101 chart = new Chart(quality);
87 scene = chart#getScene(); 102 scene = chart#getScene();
88 keys = keys values; 103 keys = keys values;
89 n = length xkeys; 104 n = length xkeys;
90 var z = 0; 105 var z = 0;
91 for keys do k: 106 for keys do k:
135 done; 150 done;
136 stacked); 151 stacked);
137 152
138 plotStacked keys xkeys unit values normalised = 153 plotStacked keys xkeys unit values normalised =
139 (quality = Quality#Nicest; 154 (quality = Quality#Nicest;
140 // quality#setAnimated(false); 155 quality#setAnimated(false);
141 chart = new Chart(quality); 156 chart = new Chart(quality);
142 scene = chart#getScene(); 157 scene = chart#getScene();
143 stacked = stack keys xkeys values normalised; 158 stacked = stack keys xkeys values normalised;
144 var z = 0; 159 var z = 0;
145 newRect x y0 y1 z colour is number -> number -> number -> number -> ~Color -> 'a = 160 newRect x y0 y1 z colour is number -> number -> number -> number -> ~Color -> 'a =