Package es.upm.etsisi.cf4j.util.plot
Class LinePlot
- java.lang.Object
-
- es.upm.etsisi.cf4j.util.plot.Plot
-
- es.upm.etsisi.cf4j.util.plot.LinePlot
-
public class LinePlot extends Plot
Implements a LinePlot.
-
-
Constructor Summary
Constructors Constructor Description LinePlot(double[] xs, String xLabel, String yLabel)
Creates a new LinePlotLinePlot(double[] xs, String xLabel, String yLabel, boolean hideLegend)
Creates a new LinePlotLinePlot(int[] xs, String xLabel, String yLabel)
Creates a new LinePlotLinePlot(int[] xs, String xLabel, String yLabel, boolean hideLegend)
Creates a new LinePlot
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinePlot
addSeries(String seriesName)
Adds a new empty series to the plot.LinePlot
addSeries(String seriesName, double value)
Adds a new series to the plot initializing all the values to a constant one.LinePlot
addSeries(String seriesName, double[] y)
Adds a new series to the plot. y values positions must be correlated with xs values.protected String[][]
getDataContent(String xAxisTicksFormat, String yAxisTicksFormat)
Returns an String matrix with the content of the plot's data.protected String[]
getDataHeaders()
Returns an String array with the headers of the plot's dataprotected de.erichseifert.gral.plots.AbstractPlot
getGralPlot()
Gets an AbstractPlot using GRALLinePlot
setValue(String seriesName, double x, double y)
Sets a single value of a seriesLinePlot
setValue(String seriesName, int x, double y)
Sets a single value of a series-
Methods inherited from class es.upm.etsisi.cf4j.util.plot.Plot
draw, exportData, exportData, exportData, exportData, exportPlot, printData, printData, printData, toString, toString, toString
-
-
-
-
Constructor Detail
-
LinePlot
public LinePlot(int[] xs, String xLabel, String yLabel)
Creates a new LinePlot- Parameters:
xs
- Values of the x axisxLabel
- Label of the x axisyLabel
- Label of the y axis
-
LinePlot
public LinePlot(int[] xs, String xLabel, String yLabel, boolean hideLegend)
Creates a new LinePlot- Parameters:
xs
- Values of the x axisxLabel
- Label of the x axisyLabel
- Label of the y axishideLegend
- Indicates if the legend must be hidden. False by default.
-
LinePlot
public LinePlot(double[] xs, String xLabel, String yLabel)
Creates a new LinePlot- Parameters:
xs
- Values of the x axisxLabel
- Label of the x axisyLabel
- Label of the y axis
-
-
Method Detail
-
addSeries
public LinePlot addSeries(String seriesName)
Adds a new empty series to the plot. All series values are initialized to 0.- Parameters:
seriesName
- Series name- Returns:
- Self LinePlot instance
-
addSeries
public LinePlot addSeries(String seriesName, double value)
Adds a new series to the plot initializing all the values to a constant one.- Parameters:
seriesName
- Series namevalue
- Constant value- Returns:
- Self LinePlot instance
-
addSeries
public LinePlot addSeries(String seriesName, double[] y)
Adds a new series to the plot. y values positions must be correlated with xs values.- Parameters:
seriesName
- Series namey
- Values- Returns:
- Self LinePlot instance
-
setValue
public LinePlot setValue(String seriesName, int x, double y)
Sets a single value of a series- Parameters:
seriesName
- Series namex
- x value. Must exists in xs.y
- y value- Returns:
- Self LinePlot instance
-
setValue
public LinePlot setValue(String seriesName, double x, double y)
Sets a single value of a series- Parameters:
seriesName
- Series namex
- x value. Must exists in xs.y
- y value- Returns:
- Self LinePlot instance
-
getDataHeaders
protected String[] getDataHeaders()
Description copied from class:Plot
Returns an String array with the headers of the plot's data- Specified by:
getDataHeaders
in classPlot
- Returns:
- Headers of the plot's data
-
getDataContent
protected String[][] getDataContent(String xAxisTicksFormat, String yAxisTicksFormat)
Description copied from class:Plot
Returns an String matrix with the content of the plot's data. First dimension denotes the row and second dimension denotes the column that must be correlated with the header returned by getDataHeaders().- Specified by:
getDataContent
in classPlot
- Parameters:
xAxisTicksFormat
- Number format for the values of the x axisyAxisTicksFormat
- Number format for the values of the x axis- Returns:
- String matrix with the content of the plot's data
-
getGralPlot
protected de.erichseifert.gral.plots.AbstractPlot getGralPlot()
Description copied from class:Plot
Gets an AbstractPlot using GRAL- Specified by:
getGralPlot
in classPlot
- Returns:
- GRAL's AbstractPlot
-
-