Interface Plot2D

All Superinterfaces:
Drawable, Measurable
All Known Implementing Classes:
Carpet, ComplexCarpet, ComplexContourPlot, 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.
Version:
1.0
Author:
Wolfgang Christian
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the ceiling for scaling the z data.
    double
    Gets the floor for scaling the z data.
    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
    Gets the autoscale flag for z.
    boolean
    Gets the symmetric z flag.
    void
    Sets the data to new values.
    void
    setAll(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
    Sets the colors that will be used between the floor and ceiling values.
    void
    setExpandedZ(boolean expanded, double expansionFactor)
    Expands the z scale so as to enhance values close to zero.
    void
    setFloorCeilColor(Color floorColor, Color ceilColor)
    Sets the floor and ceiling colors.
    void
    setGridData(GridData _griddata)
    Sets the data storage to the given value.
    void
    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
    setSymmetricZ(boolean symmetric)
    Forces the z-scale to be symmetric about zero.
    void
    setVisible(boolean isVisible)
    Sets the visibility of the plot.
    Shows how values map to colors.
    void
    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.Drawable

    draw, isInteractive

    Methods inherited from interface org.opensourcephysics.display.Measurable

    getXMax, getXMin, getYMax, getYMin, isMeasured
  • Field Details

  • Method Details

    • setAll

      void setAll(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

      void setAll(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

      void setGridData(GridData _griddata)
      Sets the data storage to the given value.
      Parameters:
      _griddata -
    • getGridData

      GridData getGridData()
      Gets the GridData object.
      Returns:
      GridData
    • indexToX

      double indexToX(int i)
      Gets the x coordinate for the given index.
      Parameters:
      i - int
      Returns:
      double the x coordinate
    • indexToY

      double indexToY(int i)
      Gets the y coordinate for the given index.
      Parameters:
      i - int
      Returns:
      double the y coordinate
    • xToIndex

      int xToIndex(double x)
      Gets closest index from the given x world coordinate.
      Parameters:
      x - double the coordinate
      Returns:
      int the index
    • yToIndex

      int yToIndex(double y)
      Gets closest index from the given y world coordinate.
      Parameters:
      y - double the coordinate
      Returns:
      int the index
    • isAutoscaleZ

      boolean isAutoscaleZ()
      Gets the autoscale flag for z.
      Returns:
      boolean
    • getFloor

      double getFloor()
      Gets the floor for scaling the z data.
      Returns:
      double
    • getCeiling

      double getCeiling()
      Gets the ceiling for scaling the z data.
      Returns:
      double
    • setAutoscaleZ

      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 -
    • setSymmetricZ

      void setSymmetricZ(boolean symmetric)
      Forces the z-scale to be symmetric about zero. Forces zmax to be positive and zmin=-zmax when in autoscale mode.
      Parameters:
      symmetric -
    • isSymmetricZ

      boolean isSymmetricZ()
      Gets the symmetric z flag.
    • setFloorCeilColor

      void setFloorCeilColor(Color floorColor, Color ceilColor)
      Sets the floor and ceiling colors.
      Parameters:
      floorColor -
      ceilColor -
    • setColorPalette

      void setColorPalette(Color[] colors)
      Sets the colors that will be used between the floor and ceiling values.
      Parameters:
      colors -
    • setPaletteType

      void setPaletteType(int type)
      Determines the palette type that will be used.
      Parameters:
      type -
    • setGridLineColor

      void setGridLineColor(Color c)
      Sets the color for grid line boundaries
      Parameters:
      c -
    • setShowGridLines

      void setShowGridLines(boolean showGrid)
      Outlines the data grid's boundaries.
      Parameters:
      showGrid -
    • showLegend

      JFrame showLegend()
      Shows how values map to colors.
    • setVisible

      void setVisible(boolean isVisible)
      Sets the visibility of the plot. Drawing will be disabled if visible is false.
      Parameters:
      isVisible -
    • setIndexes

      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

      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.
    • setExpandedZ

      void setExpandedZ(boolean expanded, double expansionFactor)
      Expands the z scale so as to enhance values close to zero.
      Parameters:
      expanded - boolean
      expansionFactor - double