Class PlotLegend

java.lang.Object
com.eco.bio7.spatial.PlotLegend

public final class PlotLegend extends Object
A legend of the 3D view (see SpatialUtil.setLegend and SpatialUtil.setColorBar): the labels with the colors of categories (e.g., the groups of a scatter plot) or a color bar of a continuous color ramp with the numbers of the values (e.g., the heights of a surface).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int[]
    A color ramp (blue - white - red) for values below and above a center.
    static final int[]
    A color ramp (blue - cyan - green - yellow - red).
    static final int[]
    A color ramp of the heights of a landscape (green - brown - white).
    static final int[]
    A color ramp (dark blue - green - yellow, like viridis).
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    rampColor(int[] colors, double min, double max, double value)
    Returns the color (0xRRGGBB) of a value of a color ramp (the colors are evenly distributed from the minimum to the maximum and interpolated), e.g., to draw the data with the colors of a color bar.
    static void
    setColor(com.jogamp.opengl.GL2 gl, int rgb)
    Sets the OpenGL color of a color (0xRRGGBB), e.g., of a color of a legend or of rampColor.

    Methods inherited from class Object

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

    • VIRIDIS

      public static final int[] VIRIDIS
      A color ramp (dark blue - green - yellow, like viridis).
    • RAINBOW

      public static final int[] RAINBOW
      A color ramp (blue - cyan - green - yellow - red).
    • DIVERGING

      public static final int[] DIVERGING
      A color ramp (blue - white - red) for values below and above a center.
    • TERRAIN

      public static final int[] TERRAIN
      A color ramp of the heights of a landscape (green - brown - white).
  • Method Details

    • rampColor

      public static int rampColor(int[] colors, double min, double max, double value)
      Returns the color (0xRRGGBB) of a value of a color ramp (the colors are evenly distributed from the minimum to the maximum and interpolated), e.g., to draw the data with the colors of a color bar.
      Parameters:
      colors - the colors of the ramp (0xRRGGBB)
      min - the value of the first color
      max - the value of the last color
      value - the value (clamped to the range)
      Returns:
      the color (0xRRGGBB)
    • setColor

      public static void setColor(com.jogamp.opengl.GL2 gl, int rgb)
      Sets the OpenGL color of a color (0xRRGGBB), e.g., of a color of a legend or of rampColor.
      Parameters:
      gl - the OpenGL context
      rgb - the color (0xRRGGBB)