public class RasterPlot extends XYPlot
Class that displays two coordinate values and a value as a raster of boxes. The data source must provide at least three columns:
The method createRasterData(DataSource)
can be used to convert
a matrix of values to the (coordinates, value) format.
To create a new RasterPlot
simply create a new instance using
a suitable data source. Example:
DataTable data = new DataTable(Double.class, Double.class); data.add(10.98, -12.34); data.add( 7.65, 45.67); data.add(43.21, 89.01); DataSource rasterData = RasterPlot.createRasterData(data); RasterPlot plot = new RasterPlot(rasterData);
Modifier and Type | Class and Description |
---|---|
protected static class |
RasterPlot.RasterRenderer
Class that renders a box and its whiskers in a box-and-whisker plot.
|
XYPlot.XYLegend, XYPlot.XYNavigationDirection, XYPlot.XYPlotArea2D, XYPlot.XYPlotNavigator
Constructor and Description |
---|
RasterPlot(DataSource data)
Initializes a new box-and-whisker plot with the specified data source.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
DataSource source,
boolean visible)
Inserts the specified data series to the plot at a specified position.
|
void |
autoscaleAxis(java.lang.String axisName)
Tries to automatically set the ranges of the axes specified by the name
if it is set to auto-scale.
|
static DataSource |
createRasterData(DataSource data)
Takes a matrix of values and creates a new data source that stores the
values in (x, y, value) format.
|
ColorMapper |
getColors()
Returns the object which is used to map pixel values to colors.
|
java.awt.geom.Dimension2D |
getDistance()
Returns the horizontal and vertical distance of the raster elements.
|
java.awt.geom.Point2D |
getOffset()
Returns the horizontal and vertical offset of the raster from the
origin.
|
void |
setColors(ColorMapper colors)
Sets the object which will be used to map pixel values to colors.
|
void |
setDistance(java.awt.geom.Dimension2D distance)
Returns the horizontal and vertical distance of the raster elements.
|
void |
setOffset(java.awt.geom.Point2D offset)
Sets the horizontal and vertical offset of the raster from the
origin.
|
createDefaultAxes, createDefaultAxisRenderers, draw, getAreaRenderer, getLineRenderer, getNavigator, getPointRenderer, layoutAxes, rangeChanged, setAreaRenderer, setAxisRenderer, setLineRenderer, setPointRenderer
add, add, autoscaleAxes, clear, contains, dataAdded, dataChanged, dataRemoved, dataUpdated, drawAxes, drawLegend, get, getAxesNames, getAxis, getAxisComponent, getAxisMax, getAxisMin, getAxisRenderer, getBackground, getBorderColor, getBorderStroke, getData, getLegend, getLegendContainer, getLegendDistance, getLegendLocation, getMapping, getPlotArea, getTitle, getVisibleData, isLegendVisible, isVisible, layout, layoutLegend, refreshLegendLayout, remove, removeAxis, setAxis, setBackground, setBorderColor, setBorderStroke, setLegend, setLegendDistance, setLegendLocation, setLegendVisible, setMapping, setPlotArea, setVisible
add, add, drawComponents, getConstraints, getDrawableAt, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size
getBounds, getHeight, getWidth, getX, getY
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds
public RasterPlot(DataSource data)
data
- Data to be displayed.public void autoscaleAxis(java.lang.String axisName)
AbstractPlot
autoscaleAxis
in interface Plot
autoscaleAxis
in class AbstractPlot
axisName
- Name of the axis that should be scaled.Axis.setAutoscaled(boolean)
public static DataSource createRasterData(DataSource data)
data
- Original data source with values in each cell.public void add(int index, DataSource source, boolean visible)
AbstractPlot
public java.awt.geom.Point2D getOffset()
public void setOffset(java.awt.geom.Point2D offset)
offset
- Horizontal and vertical offset of the raster from the
origin.public java.awt.geom.Dimension2D getDistance()
public void setDistance(java.awt.geom.Dimension2D distance)
distance
- Horizontal and vertical distance of the raster elements.public ColorMapper getColors()
public void setColors(ColorMapper colors)
colors
- Object which will be used to map pixel values to colors.