Class Heatmap


public class Heatmap extends Plot
A heat map is a graphical representation of data where the values taken by a variable in a two-dimensional map are represented as colors.
  • Constructor Details

    • Heatmap

      public Heatmap(String[] rowLabels, String[] columnLabels, double[][] z, Color[] palette)
      Constructor.
      Parameters:
      rowLabels - the labels of rows.
      columnLabels - the labels of columns.
      z - a data matrix to be shown in pseudo heat map.
      palette - the color palette.
    • Heatmap

      public Heatmap(double[] x, double[] y, double[][] z, Color[] palette)
      Constructor.
      Parameters:
      x - x coordinate of data matrix cells. Must be in ascending order.
      y - y coordinate of data matrix cells. Must be in ascending order.
      z - a data matrix to be shown in pseudo heat map.
      palette - the color palette.
  • 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
    • 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 Heatmap of(double[][] z)
      Constructor. Use 16-color jet color palette.
    • of

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

      public static Heatmap of(double[][] z, Color[] palette)
      Constructor.
      Parameters:
      z - a data matrix to be shown in pseudo heat map.
      palette - the color palette.
    • of

      public static Heatmap of(String[] rowLabels, String[] columnLabels, double[][] z)
      Constructor. Use 16-color jet color palette.
    • of

      public static Heatmap of(String[] rowLabels, String[] columnLabels, double[][] z, int k)
      Constructor. Use jet color palette.
      Parameters:
      z - a data matrix to be shown in pseudo heat map.
      k - the number of colors in the palette.
    • of

      public static Heatmap of(double[] x, double[] y, double[][] z)
      Constructor. Use 16-color jet color palette.
      Parameters:
      x - x coordinate of data matrix cells. Must be in ascending order.
      y - y coordinate of data matrix cells. Must be in ascending order.
      z - a data matrix to be shown in pseudo heat map.
    • of

      public static Heatmap of(double[] x, double[] y, double[][] z, int k)
      Constructor. Use jet color palette.
      Parameters:
      x - x coordinate of data matrix cells. Must be in ascending order.
      y - y coordinate of data matrix cells. Must be in ascending order.
      z - a data matrix to be shown in pseudo heat map.
      k - the number of colors in the palette.