Package smile.plot.swing
Class Contour
java.lang.Object
smile.plot.swing.Shape
smile.plot.swing.Plot
smile.plot.swing.Contour
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
ConstructorDescriptionContour
(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 TypeMethodDescriptioncanvas()
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.
-
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 classPlot
-
getUpperBound
public double[] getUpperBound()Description copied from class:Plot
Returns the upper bound of data.- Specified by:
getUpperBound
in classPlot
-
paint
Description copied from class:Shape
Draws the shape. -
canvas
Description copied from class:Plot
Returns a canvas of the plot. -
of
Creates a contour plot with 10 isolines.- Parameters:
z
- the data matrix to create contour plot.
-
of
Creates a contour plot.- Parameters:
z
- the data matrix to create contour plot.numLevels
- the number of contour levels.
-
of
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
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.
-