org.opensourcephysics.display2d
Interface Plot2D

All Superinterfaces:
Drawable, Measurable
All Known Implementing Classes:
ComplexGridPlot, ComplexInterpolatedPlot, ComplexSurfacePlot, ContourPlot, GrayscalePlot, GridPlot, InterpolatedPlot, SurfacePlot, VectorPlot

public interface Plot2D
extends Measurable

The Plot2D interface defines common methods for 2d-plotting such as a GridPlot, a VectorPlot, or a ContourPlot. Data must be stored in a GridData object.


Method Summary
 double getCeiling()
          Gets the ceiling for scaling the z data.
 double getFloor()
          Gets the floor for scaling the z data.
 GridData getGridData()
          Gets the GridData object.
 double indexToX(int i)
          Gets the x coordinate for the given index.
 double indexToY(int i)
          Gets the y coordinate for the given index.
 boolean isAutoscaleZ()
          Gets the autoscale flag for z.
 void setAll(java.lang.Object val)
          Sets the data to new values.
 void setAll(java.lang.Object obj, double xmin, double xmax, double ymin, double ymax)
          Sets the values and the scale.
 void setAutoscaleZ(boolean isAutoscale, double floor, double ceil)
          Sets the autoscale flag and the floor and ceiling values for the colors.
 void setColorPalette(java.awt.Color[] colors)
          Sets the colors that will be used between the floor and ceiling values.
 void setFloorCeilColor(java.awt.Color floorColor, java.awt.Color ceilColor)
          Sets the floor and ceiling colors.
 void setGridData(GridData _griddata)
          Sets the data storage to the given value.
 void setGridLineColor(java.awt.Color c)
          Sets the color for grid line boundaries
 void setIndexes(int[] indexes)
          Sets the indexes for the data components that will be plotted.
 void setPaletteType(int type)
          Determines the palette type that will be used.
 void setShowGridLines(boolean showGrid)
          Outlines the data grid's boundaries.
 void setVisible(boolean isVisible)
          Sets the visibility of the plot.
 javax.swing.JFrame showLegend()
          Shows how values map to colors.
 void update()
          Updates this object's state using new data values.
 int xToIndex(double x)
          Gets closest index from the given x world coordinate.
 int yToIndex(double y)
          Gets closest index from the given y world coordinate.
 
Methods inherited from interface org.opensourcephysics.display.Measurable
getXMax, getXMin, getYMax, getYMin, isMeasured
 
Methods inherited from interface org.opensourcephysics.display.Drawable
draw
 

Method Detail

setAll

public void setAll(java.lang.Object val)
Sets the data to new values. The grid is resized to fit the new data if needed.

Parameters:
val - an array of new values

setAll

public void setAll(java.lang.Object obj,
                   double xmin,
                   double xmax,
                   double ymin,
                   double ymax)
Sets the values and the scale. The grid is resized to fit the new data if needed.

Parameters:
obj - array of new values
xmin - double
xmax - double
ymin - double
ymax - double

setGridData

public void setGridData(GridData _griddata)
Sets the data storage to the given value.

Parameters:
_griddata -

getGridData

public GridData getGridData()
Gets the GridData object.

Returns:
GridData

indexToX

public double indexToX(int i)
Gets the x coordinate for the given index.

Parameters:
i - int
Returns:
double the x coordinate

indexToY

public double indexToY(int i)
Gets the y coordinate for the given index.

Parameters:
i - int
Returns:
double the y coordinate

xToIndex

public int xToIndex(double x)
Gets closest index from the given x world coordinate.

Parameters:
x - double the coordinate
Returns:
int the index

yToIndex

public int yToIndex(double y)
Gets closest index from the given y world coordinate.

Parameters:
y - double the coordinate
Returns:
int the index

isAutoscaleZ

public boolean isAutoscaleZ()
Gets the autoscale flag for z.

Returns:
boolean

getFloor

public double getFloor()
Gets the floor for scaling the z data.

Returns:
double

getCeiling

public double getCeiling()
Gets the ceiling for scaling the z data.

Returns:
double

setAutoscaleZ

public void setAutoscaleZ(boolean isAutoscale,
                          double floor,
                          double ceil)
Sets the autoscale flag and the floor and ceiling values for the colors. If autoscaling is true, then the min and max values of z are span the colors. If autoscaling is false, then floor and ceiling values limit the colors. Values below min map to the first color; values above max map to the last color.

Parameters:
isAutoscale -
floor -
ceil -

setFloorCeilColor

public void setFloorCeilColor(java.awt.Color floorColor,
                              java.awt.Color ceilColor)
Sets the floor and ceiling colors.

Parameters:
floorColor -
ceilColor -

setColorPalette

public void setColorPalette(java.awt.Color[] colors)
Sets the colors that will be used between the floor and ceiling values.

Parameters:
colors -

setPaletteType

public void setPaletteType(int type)
Determines the palette type that will be used.

Parameters:
type -

setGridLineColor

public void setGridLineColor(java.awt.Color c)
Sets the color for grid line boundaries

Parameters:
c -

setShowGridLines

public void setShowGridLines(boolean showGrid)
Outlines the data grid's boundaries.

Parameters:
showGrid -

showLegend

public javax.swing.JFrame showLegend()
Shows how values map to colors.


setVisible

public void setVisible(boolean isVisible)
Sets the visibility of the plot. Drawing will be disabled if visible is false.

Parameters:
isVisible -

setIndexes

public void setIndexes(int[] indexes)
Sets the indexes for the data components that will be plotted. Indexes determine the postion of the amplitude, phase, x-component, and y-component data in the data array. The amplitude index is usually the first index.

Parameters:
indexes - the sample-component indexes

update

public void update()
Updates this object's state using new data values. Update should be invoked if the data in the PointData object changes or if the z scale of the PointData object changes.