Class Contour


public class Contour extends Plot
A contour plot is a graphical technique for representing a 3-dimensional surface by plotting constant z slices, called contours, on a 2-dimensional format. That is, given a value for z, lines are drawn for connecting the (x, y) coordinates where that z value occurs. The contour plot is an alternative to a 3-D surface plot.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Contour(double[][] z, double[] levels)
    Constructor.
    Contour(double[][] z, int numLevels, boolean logScale)
    Constructor.
    Contour(double[] x, double[] y, double[][] z, double[] levels)
    Constructor.
    Contour(double[] x, double[] y, double[][] z, int numLevels, boolean logScale)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a canvas of the plot.
    double[]
    Returns the lower bound of data.
    double[]
    Returns the upper bound of data.
    static Contour
    of(double[][] z)
    Creates a contour plot with 10 isolines.
    static Contour
    of(double[][] z, int numLevels)
    Creates a contour plot.
    static Contour
    of(double[] x, double[] y, double[][] z)
    Creates a contour plot with 10 isolines.
    static Contour
    of(double[] x, double[] y, double[][] z, int numLevels)
    Creates a contour plot.
    void
    Draws the shape.

    Methods inherited from class smile.plot.swing.Plot

    legends, toolbar, tooltip

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Contour

      public Contour(double[][] z, int numLevels, boolean logScale)
      Constructor.
      Parameters:
      z - the data matrix to create contour plot.
      numLevels - the number of contour levels.
      logScale - true to interpolate contour levels in logarithmic scale.
    • Contour

      public Contour(double[][] z, double[] levels)
      Constructor.
      Parameters:
      z - the data matrix to create contour plot.
      levels - the level values of contours.
    • Contour

      public Contour(double[] x, double[] y, double[][] z, int numLevels, boolean logScale)
      Constructor.
      Parameters:
      x - the x coordinates of the data grid of z. Must be in ascending order.
      y - the y coordinates of the data grid of z. Must be in ascending order.
      z - the data matrix to create contour plot.
      numLevels - the number of contour levels.
      logScale - true to interpolate contour levels in logarithmical scale.
    • Contour

      public Contour(double[] x, double[] y, double[][] z, double[] levels)
      Constructor.
      Parameters:
      x - the x coordinates of the data grid of z. Must be in ascending order.
      y - the y coordinates of the data grid of z. Must be in ascending order.
      z - the data matrix to create contour plot.
      levels - the level values of contours. Must be strictly increasing and finite.
  • Method Details

    • getLowerBound

      public double[] getLowerBound()
      Description copied from class: Plot
      Returns the lower bound of data.
      Specified by:
      getLowerBound in class Plot
    • getUpperBound

      public double[] getUpperBound()
      Description copied from class: Plot
      Returns the upper bound of data.
      Specified by:
      getUpperBound in class Plot
    • paint

      public void paint(Graphics g)
      Description copied from class: Shape
      Draws the shape.
      Specified by:
      paint in class Shape
    • canvas

      public Canvas canvas()
      Description copied from class: Plot
      Returns a canvas of the plot.
      Overrides:
      canvas in class Plot
    • of

      public static Contour of(double[][] z)
      Creates a contour plot with 10 isolines.
      Parameters:
      z - the data matrix to create contour plot.
    • of

      public static Contour of(double[][] z, int numLevels)
      Creates a contour plot.
      Parameters:
      z - the data matrix to create contour plot.
      numLevels - the number of contour levels.
    • of

      public static Contour of(double[] x, double[] y, double[][] z)
      Creates a contour plot with 10 isolines.
      Parameters:
      x - the x coordinates of the data grid of z. Must be in ascending order.
      y - the y coordinates of the data grid of z. Must be in ascending order.
      z - the data matrix to create contour plot.
    • of

      public static Contour of(double[] x, double[] y, double[][] z, int numLevels)
      Creates a contour plot.
      Parameters:
      x - the x coordinates of the data grid of z. Must be in ascending order.
      y - the y coordinates of the data grid of z. Must be in ascending order.
      z - the data matrix to create contour plot.
      numLevels - the number of contour levels.