Class Base

java.lang.Object
smile.plot.swing.Base

public class Base extends Object
The coordinate base of Canvas. This support both 2D and 3D device-independent logical space where graphics primitives are specified.

The user need supply the lower and upper bounds for each axis. These bounds usually are extended (a little) internally for better view purpose.

  • Constructor Details Link icon

    • Base Link icon

      public Base(double[] lowerBound, double[] upperBound)
      Constructor.
      Parameters:
      lowerBound - the lower bound of base.
      upperBound - the upper bound of base.
    • Base Link icon

      public Base(double[] lowerBound, double[] upperBound, boolean extendBound)
      Constructor.
      Parameters:
      lowerBound - the lower bound of base.
      upperBound - the upper bound of base.
      extendBound - true if extending the bounds for padding.
  • Method Details Link icon

    • reset Link icon

      public void reset()
      Reset base coordinates. Round/extend lower and upper bounds if necessary.
    • getDimension Link icon

      public int getDimension()
      Returns the dimensionality of coordinates.
      Returns:
      the dimensionality of coordinates.
    • extendBound Link icon

      public void extendBound(int i)
      Rounds the bounds for axis i.
      Parameters:
      i - the index of axis.
    • setBound Link icon

      public void setBound(double[] lowerBound, double[] upperBound)
      Sets the axis bounds without applying the extending heuristic.
      Parameters:
      lowerBound - the lower bound.
      upperBound - the upper bound
    • getCoordinateSpace Link icon

      public double[][] getCoordinateSpace()
      Returns the coordinates.
      Returns:
      the coordinates.
    • getLowerBounds Link icon

      public double[] getLowerBounds()
      Returns the lower bounds.
      Returns:
      the lower bounds.
    • getUpperBounds Link icon

      public double[] getUpperBounds()
      Returns the upper bounds.
      Returns:
      the upper bounds.
    • getPrecisionUnit Link icon

      public double[] getPrecisionUnit()
      Returns the precision units of axes.
      Returns:
      the precision units of axes.
    • getPrecisionDigits Link icon

      public int[] getPrecisionDigits()
      Returns the precision unit digits of axes.
      Returns:
      the precision unit digits of axes.
    • extendLowerBound Link icon

      public void extendLowerBound(double[] bound)
      Extends lower bounds.
      Parameters:
      bound - the new bound.
    • extendUpperBound Link icon

      public void extendUpperBound(double[] bound)
      Extends upper bounds.
      Parameters:
      bound - the new bound.
    • extendBound Link icon

      public void extendBound(double[] lowerBound, double[] upperBound)
      Extends lower and upper bounds.
      Parameters:
      lowerBound - the new lower bound.
      upperBound - the new upper bound.
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object