Bug plotting -Infinity

This commit is contained in:
2014-08-19 15:37:08 +02:00
parent 9906e7c240
commit b7aaaf160d
3 changed files with 11 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ import ch.psi.plot.utils.SwingUtils;
import java.awt.Color; import java.awt.Color;
/** /**
* * Data representation for LinePlot.
*/ */
public class LinePlotSeries extends PlotSeries<LinePlot> { public class LinePlotSeries extends PlotSeries<LinePlot> {

View File

@@ -4,7 +4,7 @@ import java.util.Arrays;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
* PlotData implementation optimized for matrix data. * Data representation for MatrixPlot.
*/ */
public class MatrixPlotSeries extends PlotSeries<MatrixPlot> { public class MatrixPlotSeries extends PlotSeries<MatrixPlot> {
@@ -144,12 +144,13 @@ public class MatrixPlotSeries extends PlotSeries<MatrixPlot> {
double[][] data = getData(); double[][] data = getData();
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {
for (int j = 0; j < data[0].length; j++) { for (int j = 0; j < data[0].length; j++) {
if (data[i][j] != Double.NEGATIVE_INFINITY) { double val=data[i][j];
if (Double.isNaN(min) || (data[i][j] < min)) { if ((!Double.isNaN(val)) && (!Double.isInfinite(val))) {
min = data[i][j]; if (Double.isNaN(min) || (val < min)) {
min = val;
} }
if (Double.isNaN(max) || (data[i][j] > max)) { if (Double.isNaN(max) || (val > max)) {
max = data[i][j]; max = val;
} }
} }
} }

View File

@@ -115,9 +115,9 @@ public class MatrixPlot extends MatrixPlotBase {
xvalues = new double[arraylength]; xvalues = new double[arraylength];
yvalues = new double[arraylength]; yvalues = new double[arraylength];
zvalues = new double[arraylength]; zvalues = new double[arraylength];
Arrays.fill(xvalues, Double.NEGATIVE_INFINITY); Arrays.fill(xvalues, Double.NaN);
Arrays.fill(yvalues, Double.NEGATIVE_INFINITY); Arrays.fill(yvalues, Double.NaN);
Arrays.fill(zvalues, Double.NEGATIVE_INFINITY); Arrays.fill(zvalues, Double.NaN);
double[][] dataArray = new double[][]{xvalues, yvalues, zvalues}; double[][] dataArray = new double[][]{xvalues, yvalues, zvalues};
//Create the XYDataset (org.jfree), not to be confused with the ch.psi dataSet) //Create the XYDataset (org.jfree), not to be confused with the ch.psi dataSet)
data = new DefaultXYZDataset(); data = new DefaultXYZDataset();