Class Hexmap


public class Hexmap extends Plot
Hexmap is a variant of heat map by replacing rectangle cells with hexagon cells.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    The lambda interface to retrieve the tooltip of cell.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hexmap(double[][] z, Color[] palette, Hexmap.Tooltip tooltip)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a figure containing the plot.
    double[]
    Returns the lower bound of data.
    double[]
    Returns the upper bound of data.
    static Hexmap
    of(double[][] z)
    Creates a hexmap with 16-color jet color palette.
    static Hexmap
    of(double[][] z, int k)
    Creates a hexmap with the jet color palette.
    static Hexmap
    of(double[][] z, Color[] palette)
    Creates a hexmap with given color palette.
    void
    Draws the shape.
    tooltip(double[] coord)
    Returns an optional tooltip for the object at given coordinates.

    Methods inherited from class smile.plot.swing.Plot

    legends, toolbar

    Methods inherited from class java.lang.Object

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

    • Hexmap

      public Hexmap(double[][] z, Color[] palette, Hexmap.Tooltip tooltip)
      Constructor.
      Parameters:
      z - a data matrix to be shown in hexmap.
      palette - the color palette.
      tooltip - the lambda to return the description of cells.
  • Method Details

    • tooltip

      public Optional<String> tooltip(double[] coord)
      Description copied from class: Plot
      Returns an optional tooltip for the object at given coordinates.
      Overrides:
      tooltip in class Plot
      Parameters:
      coord - the logical coordinates of current mouse position.
      Returns:
      a string if an object with label close to the given coordinates.
    • getLowerBound

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

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

      public void paint(Renderer g)
      Description copied from class: Shape
      Draws the shape.
      Specified by:
      paint in class Shape
      Parameters:
      g - the renderer.
    • figure

      public Figure figure()
      Description copied from class: Plot
      Returns a figure containing the plot.
      Overrides:
      figure in class Plot
      Returns:
      a figure containing the plot.
    • of

      public static Hexmap of(double[][] z)
      Creates a hexmap with 16-color jet color palette.
      Parameters:
      z - a data matrix to be shown in hexmap.
      Returns:
      the hexmap.
    • of

      public static Hexmap of(double[][] z, int k)
      Creates a hexmap with the jet color palette.
      Parameters:
      z - a data matrix to be shown in hexmap.
      k - the number of colors in the palette.
      Returns:
      the hexmap.
    • of

      public static Hexmap of(double[][] z, Color[] palette)
      Creates a hexmap with given color palette.
      Parameters:
      z - a data matrix to be shown in hexmap.
      palette - the color palette.
      Returns:
      the hexmap.