de.erichseifert.gral.plots
Class RasterPlot
- java.lang.Object
-
- All Implemented Interfaces:
- DataListener, Container, Drawable, Navigable, AxisListener, Plot, java.io.Serializable, java.lang.Iterable<Drawable>
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:
- x coordinate
- y coordinate
- value
The method
createRasterData(DataSource)can be used to convert a matrix of values to the (coordinates, value) format.To create a new
RasterPlotsimply 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);
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.erichseifert.gral.plots.XYPlot
XYPlot.XYLegend, XYPlot.XYNavigationDirection, XYPlot.XYPlotArea2D, XYPlot.XYPlotNavigator
-
-
Constructor Summary
Constructors Constructor and Description RasterPlot(DataSource data)Initializes a new box-and-whisker plot with the specified data source.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, DataSource source, boolean visible)Inserts the specified data series to the plot at a specified position.voidautoscaleAxis(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 DataSourcecreateRasterData(DataSource data)Takes a matrix of values and creates a new data source that stores the values in (x, y, value) format.ColorMappergetColors()Returns the object which is used to map pixel values to colors.java.awt.geom.Dimension2DgetDistance()Returns the horizontal and vertical distance of the raster elements.java.awt.geom.Point2DgetOffset()Returns the horizontal and vertical offset of the raster from the origin.voidsetColors(ColorMapper colors)Sets the object which will be used to map pixel values to colors.voidsetDistance(java.awt.geom.Dimension2D distance)Returns the horizontal and vertical distance of the raster elements.voidsetOffset(java.awt.geom.Point2D offset)Sets the horizontal and vertical offset of the raster from the origin.-
Methods inherited from class de.erichseifert.gral.plots.XYPlot
addPointRenderer, draw, getAreaRenderers, getLineRenderers, getNavigator, getPointRenderers, rangeChanged, removePointRenderer, setAreaRenderers, setAreaRenderers, setAxisRenderer, setLineRenderers, setLineRenderers, setPointRenderers, setPointRenderers
-
Methods inherited from class de.erichseifert.gral.plots.AbstractPlot
add, add, clear, contains, dataAdded, dataRemoved, dataUpdated, get, getAxesNames, getAxis, getAxisRenderer, getBackground, getBorderColor, getBorderStroke, getData, getFont, getLegend, getLegendDistance, getLegendLocation, getMapping, getPlotArea, getTitle, getVisibleData, isLegendVisible, isVisible, layout, remove, removeAxis, setAxis, setBackground, setBorderColor, setBorderStroke, setFont, setLegendDistance, setLegendLocation, setLegendVisible, setMapping, setVisible
-
Methods inherited from class de.erichseifert.gral.graphics.DrawableContainer
add, add, contains, getConstraints, getDrawables, getDrawablesAt, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size
-
Methods inherited from class de.erichseifert.gral.graphics.AbstractDrawable
getBounds, getHeight, getWidth, getX, getY, setPosition
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.erichseifert.gral.graphics.Drawable
getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds, setPosition
-
Methods inherited from interface de.erichseifert.gral.graphics.Container
add, add, contains, getBounds, getConstraints, getDrawables, getDrawablesAt, getInsets, getLayout, remove, setBounds, setInsets, setLayout, size
-
-
-
-
Constructor Detail
-
RasterPlot
public RasterPlot(DataSource data)
Initializes a new box-and-whisker plot with the specified data source.- Parameters:
data- Data to be displayed.
-
-
Method Detail
-
autoscaleAxis
public void autoscaleAxis(java.lang.String axisName)
Description copied from class:AbstractPlotTries to automatically set the ranges of the axes specified by the name if it is set to auto-scale.- Specified by:
autoscaleAxisin interfacePlot- Overrides:
autoscaleAxisin classAbstractPlot- Parameters:
axisName- Name of the axis that should be scaled.- See Also:
Axis.setAutoscaled(boolean)
-
createRasterData
public 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.- Parameters:
data- Original data source with values in each cell.- Returns:
- New data source with (x, y, value) columns
-
add
public void add(int index, DataSource source, boolean visible)Description copied from class:AbstractPlotInserts the specified data series to the plot at a specified position.
-
getOffset
public java.awt.geom.Point2D getOffset()
Returns the horizontal and vertical offset of the raster from the origin.- Returns:
- Horizontal and vertical offset of the raster from the origin.
-
setOffset
public void setOffset(java.awt.geom.Point2D offset)
Sets the horizontal and vertical offset of the raster from the origin.- Parameters:
offset- Horizontal and vertical offset of the raster from the origin.
-
getDistance
public java.awt.geom.Dimension2D getDistance()
Returns the horizontal and vertical distance of the raster elements.- Returns:
- Horizontal and vertical distance of the raster elements.
-
setDistance
public void setDistance(java.awt.geom.Dimension2D distance)
Returns the horizontal and vertical distance of the raster elements.- Parameters:
distance- Horizontal and vertical distance of the raster elements.
-
getColors
public ColorMapper getColors()
Returns the object which is used to map pixel values to colors.- Returns:
- Object which is used to map pixel values to colors.
-
setColors
public void setColors(ColorMapper colors)
Sets the object which will be used to map pixel values to colors.- Parameters:
colors- Object which will be used to map pixel values to colors.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG