-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathPlotPanel.java
More file actions
693 lines (595 loc) · 26 KB
/
PlotPanel.java
File metadata and controls
693 lines (595 loc) · 26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
package org.math.plot;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import org.math.io.files.ASCIIFile;
import org.math.plot.canvas.PlotCanvas;
import org.math.plot.components.LegendPanel;
import org.math.plot.components.PlotToolBar;
import org.math.plot.plotObjects.Axis;
import org.math.plot.plotObjects.Plotable;
import org.math.plot.plots.Plot;
import org.math.plot.utils.Array;
/**
* BSD License
*
* @author Yann RICHET
*/
public abstract class PlotPanel extends JPanel {
public enum Type {
SCATTER, LINE, BAR, HISTOGRAM, BOX, STAIRCASE, GRID;
}
private static final long serialVersionUID = 1L;
public PlotToolBar plotToolBar;
public PlotCanvas plotCanvas;
public LegendPanel plotLegend;
public final static String EAST = BorderLayout.EAST;
public final static String SOUTH = BorderLayout.SOUTH;
public final static String NORTH = BorderLayout.NORTH;
public final static String WEST = BorderLayout.WEST;
public final static String INVISIBLE = "INVISIBLE";
public final static Color[] COLORLIST = {Color.BLUE, Color.RED, Color.GREEN, Color.YELLOW, Color.ORANGE, Color.PINK, Color.CYAN, Color.MAGENTA};
private Font font = new Font("Arial", Font.PLAIN, 10);
public PlotPanel(PlotCanvas _canvas, String legendOrientation) {
plotCanvas = _canvas;
setBackground(Color.WHITE);
setLayout(new BorderLayout());
addPlotToolBar(NORTH);
addLegend(legendOrientation);
add(plotCanvas, BorderLayout.CENTER);
}
public PlotPanel(PlotCanvas _canvas) {
this(_canvas, INVISIBLE);
}
/**
* Defines where the legend of the plot should be added to the plot
* panel.
*
* @param location Location where should be put the legend (String).
* location can have the following values (case insensitive): EAST,
* SOUTH, WEST, NORTH, INVISIBLE (legend will be hidden in this case).
* Any other value will be ignored and an error message will be sent to
* the error output.
*/
public void addLegend(String location) {
if (location.equalsIgnoreCase(EAST)) {
plotLegend = new LegendPanel(this, LegendPanel.VERTICAL);
add(plotLegend, EAST);
} else if (location.equalsIgnoreCase(SOUTH)) {
plotLegend = new LegendPanel(this, LegendPanel.HORIZONTAL);
add(plotLegend, SOUTH);
} else if (location.equalsIgnoreCase(WEST)) {
plotLegend = new LegendPanel(this, LegendPanel.VERTICAL);
add(plotLegend, WEST);
} else if (location.equalsIgnoreCase(NORTH)) {
plotLegend = new LegendPanel(this, LegendPanel.HORIZONTAL);
add(plotLegend, NORTH);
} else if (location.equalsIgnoreCase(INVISIBLE)) {
plotLegend = new LegendPanel(this, LegendPanel.INVISIBLE);
// add(legends, BorderLayout.NORTH);
} else {
System.err.println("Orientation " + location + " is unknonw.");
}
}
/**
* Removes the current legend from the plot panel.
*/
public void removeLegend() {
remove(plotLegend);
}
/**
* Moves the legend to the specified location.
*
* @param location Location where should be put the legend (String).
* location can have the following values (case insensitive): EAST,
* SOUTH, WEST, NORTH, INVISIBLE (legend will be hidden in this case).
* Any other value will be ignored and an error message will be sent to
* the error output.
*/
public void setLegendOrientation(String location) {
removeLegend();
addLegend(location);
}
/**
* Adds a new plot toolbar to the specified location. The previous toolbar
* is deleted.
* @param location Location where should be put the toolbar (String).
* location can have the following values (case insensitive): EAST,
* SOUTH, WEST, NORTH.
* Any other value will be ignored and an error message will be sent to
* the error output.
*/
public void addPlotToolBar(String location) {
if (location.equalsIgnoreCase(EAST)) {
removePlotToolBar();
plotToolBar = new PlotToolBar(this);
plotToolBar.setFloatable(false);
add(plotToolBar, EAST);
} else if (location.equalsIgnoreCase(SOUTH)) {
removePlotToolBar();
plotToolBar = new PlotToolBar(this);
plotToolBar.setFloatable(false);
add(plotToolBar, SOUTH);
} else if (location.equalsIgnoreCase(WEST)) {
removePlotToolBar();
plotToolBar = new PlotToolBar(this);
plotToolBar.setFloatable(false);
add(plotToolBar, WEST);
} else if (location.equalsIgnoreCase(NORTH)) {
removePlotToolBar();
plotToolBar = new PlotToolBar(this);
plotToolBar.setFloatable(false);
add(plotToolBar, NORTH);
} else {
System.err.println("Location " + location + " is unknonw.");
}
}
/**
* Removes the plot toolbar from the panel.
*/
public void removePlotToolBar() {
if (plotToolBar == null) {
return;
}
remove(plotToolBar);
}
/**
* Moves the plot toolbar to the specified location.
* @param location Location where should be put the toolbar (String).
* location can have the following values (case insensitive): EAST,
* SOUTH, WEST, NORTH.
* Any other value will be ignored and an error message will be sent to
* the error output.
*/
public void setPlotToolBarOrientation(String location) {
addPlotToolBar(location);
}
public PlotToolBar getPlotToolBar() {
return plotToolBar;
}
public void setAdjustBounds(boolean adjust) {
plotCanvas.setAdjustBounds(adjust);
if (plotToolBar != null) {
plotToolBar.ajustBoundsChanged();
}
}
// ///////////////////////////////////////////
// ////// set actions ////////////////////////
// ///////////////////////////////////////////
public void setActionMode(int am) {
plotCanvas.setActionMode(am);
}
public void setNoteCoords(boolean b) {
plotCanvas.setNoteCoords(b);
}
public void setEditable(boolean b) {
plotCanvas.setEditable(b);
}
public boolean getEditable() {
return plotCanvas.getEditable();
}
public void setNotable(boolean b) {
plotCanvas.setNotable(b);
}
public boolean getNotable() {
return plotCanvas.getNotable();
}
// ///////////////////////////////////////////
// ////// set/get elements ///////////////////
// ///////////////////////////////////////////
public LinkedList<Plot> getPlots() {
return plotCanvas.getPlots();
}
public Plot getPlot(int i) {
return plotCanvas.getPlot(i);
}
public int getPlotIndex(Plot p) {
return plotCanvas.getPlotIndex(p);
}
public LinkedList<Plotable> getPlotables() {
return plotCanvas.getPlotables();
}
public Plotable getPlotable(int i) {
return plotCanvas.getPlotable(i);
}
/**
* Return the axis specified in parameter.
* @param i Axis number. 0 for X, 1 for Y, 2 for Z.
* @return The axis which number is given in parameter.
*/
public Axis getAxis(int i) {
return plotCanvas.getGrid().getAxis(i);
}
/**
* Returns the scaling for all of the axis of the plot.
* @return An array of String
*
*/
public String[] getAxisScales() {
return plotCanvas.getAxisScales();
}
// TODO axes labels are rested after addPlot... correct this.
/**
* Sets the name of the axis, in this order: X, Y and Z.
* @param labels One to three strings containing the name of each axis.
*/
public void setAxisLabels(String... labels) {
plotCanvas.setAxisLabels(labels);
}
/**
* Sets the name of the axis specified in parameter.
* @param axe Axis number. 0 for X, 1 for Y, 2 for Z.
* @param label Name to be given.
*/
public void setAxisLabel(int axe, String label) {
plotCanvas.setAxisLabel(axe, label);
}
/**
* Sets the scale of the axes, linear or logarithm, in this order: X,Y,Z.
* @param scales Strings containing the scaling, LOG or LIN (case insensitive) for the axes.
*/
public void setAxisScales(String... scales) {
plotCanvas.setAxisScales(scales);
}
/**
* Sets the scaling of the specified axis.
* @param axe Axis number. 0 for X, 1 for Y, 2 for Z.
* @param scale String specifying the scaling. LIN or LOG, case insensitive.
*/
public void setAxisScale(int axe, String scale) {
plotCanvas.setAxiScale(axe, scale);
}
/**
* Sets the boundaries for each axis.
* @param min Array of at most 3 doubles specifying the min bound of each axis, in this order: X,Y,Z.
* @param max Array of at most 3 doubles specifying the max bound of each axis, in this order: X,Y,Z.
*/
public void setFixedBounds(double[] min, double[] max) {
plotCanvas.setFixedBounds(min, max);
}
/**
* Sets the boundaries for the specified axis.
* @param axe Axis number to modify. 0 for X, 1 for Y, 2 for Z.
* @param min Min bound of the axis.
* @param max Max bound of the axis.
*/
public void setFixedBounds(int axe, double min, double max) {
plotCanvas.setFixedBounds(axe, min, max);
}
/**
* Modify bounds of the axes so as to include the point given in parameter.
* @param into Coords of the point to include in bounds.
*/
public void includeInBounds(double... into) {
plotCanvas.includeInBounds(into);
}
/**
* Modify axes boundaries so as to include all the points of a given plot.
* @param plot Plot to include.
*/
public void includeInBounds(Plot plot) {
plotCanvas.includeInBounds(plot);
}
/**
* Set bounds automatically.
*/
public void setAutoBounds() {
plotCanvas.setAutoBounds();
}
/**
* Set bounds automatically for one axis.
* @param axe Number of the axis to modify. 0 for X, 1 for Y, 2 for Z.
*/
public void setAutoBounds(int axe) {
plotCanvas.setAutoBounds(axe);
}
public double[][] mapData(Object[][] stringdata) {
return plotCanvas.mapData(stringdata);
}
public void resetMapData() {
plotCanvas.resetMapData();
}
// ///////////////////////////////////////////
// ////// add/remove elements ////////////////
// ///////////////////////////////////////////
public void addLabel(String text, Color c, double... where) {
plotCanvas.addLabel(text, c, where);
}
public void addBaseLabel(String text, Color c, double... where) {
plotCanvas.addBaseLabel(text, c, where);
}
public void addPlotable(Plotable p) {
plotCanvas.addPlotable(p);
}
public void removePlotable(Plotable p) {
plotCanvas.removePlotable(p);
}
public void removePlotable(int i) {
plotCanvas.removePlotable(i);
}
public void removeAllPlotables() {
plotCanvas.removeAllPlotables();
}
public int addPlot(Plot newPlot) {
return plotCanvas.addPlot(newPlot);
}
protected Color getNewColor() {
return COLORLIST[plotCanvas.plots.size() % COLORLIST.length];
}
public int addPlot(Type type, String name, double[]... v) {
return addPlot(type, name, getNewColor(), v);
}
public abstract int addPlot(Type type, String name, Color c, double[]... v);
public void setPlot(int I, Plot p) {
plotCanvas.setPlot(I, p);
}
public void changePlotData(int I, double[]... XY) {
plotCanvas.changePlotData(I, XY);
}
public void changePlotName(int I, String name) {
plotCanvas.changePlotName(I, name);
}
public void changePlotColor(int I, Color c) {
plotCanvas.changePlotColor(I, c);
}
public void removePlot(int I) {
plotCanvas.removePlot(I);
}
public void removePlot(Plot p) {
plotCanvas.removePlot(p);
}
public void removeAllPlots() {
plotCanvas.removeAllPlots();
}
public void addVectortoPlot(int numPlot, double[][] v) {
plotCanvas.addVectortoPlot(numPlot, v);
}
public void addQuantiletoPlot(int numPlot, int numAxe, double rate, boolean symetric, double[] q) {
plotCanvas.addQuantiletoPlot(numPlot, numAxe, rate, symetric, q);
}
public void addQuantiletoPlot(int numPlot, int numAxe, double rate, boolean symetric, double q) {
plotCanvas.addQuantiletoPlot(numPlot, numAxe, rate, symetric, q);
}
public void addQuantilestoPlot(int numPlot, int numAxe, double[][] q) {
plotCanvas.addQuantilestoPlot(numPlot, numAxe, q);
}
public void addQuantilestoPlot(int numPlot, int numAxe, double[] q) {
plotCanvas.addQuantilestoPlot(numPlot, numAxe, q);
}
public void addGaussQuantilestoPlot(int numPlot, int numAxe, double[] s) {
plotCanvas.addGaussQuantilestoPlot(numPlot, numAxe, s);
}
public void addGaussQuantilestoPlot(int numPlot, int numAxe, double s) {
plotCanvas.addGaussQuantilestoPlot(numPlot, numAxe, s);
}
public void toGraphicFile(File file) throws IOException {
// otherwise toolbar appears
plotToolBar.setVisible(false);
Image image = createImage(getWidth(), getHeight());
paint(image.getGraphics());
image = new ImageIcon(image).getImage();
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bufferedImage.createGraphics();
g.drawImage(image, 0, 0, Color.WHITE, null);
g.dispose();
// make it reappear
plotToolBar.setVisible(true);
try {
ImageIO.write((RenderedImage) bufferedImage, "PNG", file);
} catch (IllegalArgumentException ex) {
}
}
public static void main(String[] args) {
String man = "Usage: jplot.<sh|bat> <-2D|-3D> [-l <INVISIBLE|NORTH|SOUTH|EAST|WEST>] [options] <ASCII file (n rows, m columns)> [[options] other ASCII file]\n" + "[-l <INVISIBLE|NORTH|SOUTH|EAST|WEST>] giving the legend position\n" + "[options] are:\n" + " -t <SCATTER|LINE|BAR|HISTOGRAM2D(<integer h>)|HISTOGRAM3D(<integer h>,<integer k>)|GRID3D|CLOUD2D(<integer h>,<integer k>)|CLOUD3D(<integer h>,<integer k>,<integer l>)> type of the plot\n" + " SCATTER|LINE|BAR: each line of the ASCII file contains coordinates of one point.\n" + " HISTOGRAM2D(<integer h>): ASCII file contains the 1D sample (i.e. m=1) to split in h slices.\n" + " HISTOGRAM3D(<integer h>,<integer k>): ASCII file contains the 2D sample (i.e. m=2) to split in h*k slices (h slices on X axis and k slices on Y axis).\n" + " GRID3D: ASCII file is a matrix, first row gives n X grid values, first column gives m Y grid values, other values are Z values.\n" + " CLOUD2D(<integer h>,<integer k>): ASCII file contains the 2D sample (i.e. m=2) to split in h*k slices (h slices on X axis and k slices on Y axis), density of cloud corresponds to frequency of X-Y slice in given 2D sample.\n" + " CLOUD3D(<integer h>,<integer k>,<integer l>): ASCII file contains the 3D sample (i.e. m=3) to split in h*k*l slices (h slices on X axis, k slices on Y axis, l slices on Y axis), density of cloud corresponds to frequency of X-Y-Z slice in given 3D sample.\n" + " -n name name of the plot\n" + " -v <ASCII file (n,3|2)> vector data to add to the plot\n" + " -q<X|Y|Z>(<float Q>) <ASCII file (n,1)> Q-quantile to add to the plot on <X|Y|Z> axis. Each line of the given ASCII file contains the value of quantile for probvability Q.\n" + " -qP<X|Y|Z> <ASCII file (n,p)> p-quantiles density to add to the plot on <X|Y|Z> axis. Each line of the given ASCII file contains p values.\n" + " -qN<X|Y|Z> <ASCII file (n,1)> Gaussian density to add to the plot on <X|Y|Z> axis. Each line of the given ASCII file contains a standard deviation.";
if (args.length == 0) {
double[][] data = new double[20][];
for (int i = 0; i < data.length; i++) {
data[i] = new double[]{Math.random(), Math.random(), Math.random()};
}
ASCIIFile.writeDoubleArray(new File("tmp.dat"), data);
args = new String[]{"-3D", "-l", "SOUTH", "-t", "SCATTER", "tmp.dat"};
System.out.println(man);
System.out.println("\nExample: jplot.<sh|bat> " + Array.cat(args));
}
PlotPanel p = null;
if (args[0].equals("-2D")) {
p = new Plot2DPanel();
} else if (args[0].equals("-3D")) {
p = new Plot3DPanel();
} else {
System.out.println(man);
}
try {
String leg = "INVISIBLE";
String type = "SCATTER";
String name = "";
double[][] v = null;
double[] qX = null;
double[] qY = null;
double[] qZ = null;
double qXp = 0;
double qYp = 0;
double qZp = 0;
double[][] qPX = null;
double[][] qPY = null;
double[][] qPZ = null;
double[] qNX = null;
double[] qNY = null;
double[] qNZ = null;
for (int i = 1; i < args.length; i++) {
//System.out.println("<" + args[i] + ">");
if (args[i].equals("-l")) {
leg = args[i + 1];
i++;
} else if (args[i].equals("-t")) {
type = args[i + 1];
i++;
} else if (args[i].equals("-n")) {
name = args[i + 1];
i++;
} else if (args[i].equals("-v")) {
v = ASCIIFile.readDoubleArray(new File(args[i + 1]));
i++;
} else if (args[i].startsWith("-qX(")) {
qX = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
qXp = Double.parseDouble(args[i].substring(4, args[i].length() - 1));
i++;
} else if (args[i].startsWith("-qY(")) {
qY = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
qYp = Double.parseDouble(args[i].substring(4, args[i].length() - 1));
i++;
} else if (args[i].startsWith("-qZ(")) {
qZ = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
qZp = Double.parseDouble(args[i].substring(4, args[i].length() - 1));
i++;
} else if (args[i].equals("-qPX")) {
qPX = ASCIIFile.readDoubleArray(new File(args[i + 1]));
i++;
} else if (args[i].equals("-qPY")) {
qPY = ASCIIFile.readDoubleArray(new File(args[i + 1]));
i++;
} else if (args[i].equals("-qPZ")) {
qPZ = ASCIIFile.readDoubleArray(new File(args[i + 1]));
i++;
} else if (args[i].equals("-qNX")) {
qNX = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
i++;
} else if (args[i].equals("-qNY")) {
qNY = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
i++;
} else if (args[i].equals("-qNZ")) {
qNZ = ASCIIFile.readDouble1DArray(new File(args[i + 1]));
i++;
} else {
File input_file = new File(args[i]);
int n = 0;
if (input_file.exists()) {
if (name.length() == 0) {
name = input_file.getName();
}
if (p instanceof Plot2DPanel) {
Plot2DPanel p2d = (Plot2DPanel) p;
if (type.equals("SCATTER")) {
n = p2d.addScatterPlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.equals("LINE")) {
n = p2d.addLinePlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.equals("BAR")) {
n = p2d.addBarPlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.startsWith("HISTOGRAM2D(")) {
n = p2d.addHistogramPlot(name, ASCIIFile.readDouble1DArray(input_file), Integer.parseInt(type.substring(12, type.length() - 1)));
} else if (type.startsWith("CLOUD2D(")) {
n = p2d.addCloudPlot(name, ASCIIFile.readDoubleArray(input_file), Integer.parseInt(type.substring(8, type.indexOf(","))),
Integer.parseInt(type.substring(type.indexOf(",") + 1, type.length() - 1)));
} else {
for (Type t : Type.values()) {
if (t.name().equalsIgnoreCase(type))
p2d.addPlot(t, name, ASCIIFile.readDoubleArray(input_file));
}
}
} else {
Plot3DPanel p3d = (Plot3DPanel) p;
if (type.equals("SCATTER")) {
n = p3d.addScatterPlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.equals("LINE")) {
n = p3d.addLinePlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.equals("BAR")) {
n = p3d.addBarPlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.startsWith("HISTOGRAM3D(")) {
n = p3d.addHistogramPlot(name, ASCIIFile.readDoubleArray(input_file), Integer.parseInt(type.substring(12, type.indexOf(","))),
Integer.parseInt(type.substring(type.indexOf(",") + 1, type.length() - 1)));
} else if (type.equals("GRID3D")) {
n = p3d.addGridPlot(name, ASCIIFile.readDoubleArray(input_file));
} else if (type.startsWith("CLOUD3D(")) {
n = p3d.addCloudPlot(name, ASCIIFile.readDoubleArray(input_file), Integer.parseInt(type.substring(8, type.indexOf(","))),
Integer.parseInt(type.substring(type.indexOf(",") + 1, type.indexOf(",", type.indexOf(",") + 1))), Integer.parseInt(type.substring(type.indexOf(",", type.indexOf(",") + 1) + 1, type.length() - 1)));
} else {
for (Type t : Type.values()) {
if (t.name().equalsIgnoreCase(type))
p3d.addPlot(t, name, ASCIIFile.readDoubleArray(input_file));
}
}
}
if (v != null) {
p.addVectortoPlot(n, v);
}
if (qX != null) {
p.addQuantiletoPlot(n, 0, qXp, false, qX);
}
if (qY != null) {
p.addQuantiletoPlot(n, 1, qYp, false, qY);
}
if (qZ != null) {
p.addQuantiletoPlot(n, 2, qZp, false, qZ);
}
if (qPX != null) {
p.addQuantilestoPlot(n, 0, qPX);
}
if (qPY != null) {
p.addQuantilestoPlot(n, 1, qPY);
}
if (qPZ != null) {
p.addQuantilestoPlot(n, 2, qPZ);
}
if (qNX != null) {
p.addGaussQuantilestoPlot(n, 0, qNX);
}
if (qNY != null) {
p.addGaussQuantilestoPlot(n, 1, qNY);
}
if (qNZ != null) {
p.addGaussQuantilestoPlot(n, 2, qNZ);
}
type = "SCATTER";
leg = "SOUTH";
name = "";
qX = null;
qY = null;
qZ = null;
qXp = 0;
qYp = 0;
qZp = 0;
v = null;
qPX = null;
qPY = null;
qPZ = null;
qNX = null;
qNY = null;
qNZ = null;
} else {
System.out.println("File " + args[i] + " unknown.");
System.out.println(man);
}
}
}
p.setLegendOrientation(leg);
FrameView f = new FrameView(p);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} catch (Exception e) {
e.printStackTrace();
System.err.println("\n" + man);
}
}
/**
* @return the font
*/
public Font getFont() {
return font;
}
/**
* @param font the font to set
*/
public void setFont(Font font) {
this.font = font;
}
}