Klasse LogarithmicRenderer2D

java.lang.Object
de.erichseifert.gral.plots.axes.AbstractAxisRenderer2D
de.erichseifert.gral.plots.axes.LogarithmicRenderer2D
Alle implementierten Schnittstellen:
AxisRenderer

public class LogarithmicRenderer2D extends AbstractAxisRenderer2D

An AxisRenderer with a base-10 logarithmic scale: each decade takes the same distance on screen, which is what makes data spanning several orders of magnitude readable.

plot.setAxisRenderer(XYPlot.AXIS_X, new LogarithmicRenderer2D());
plot.getAxis(XYPlot.AXIS_X).setRange(1.0, 1000.0);

Ticks are laid out per decade rather than at a fixed distance: a major tick at each power of ten, with the minor ticks distributed over the decade that follows it. The tick spacing and the minor tick count are therefore interpreted relative to a decade, not in axis units as they are on a linear axis.

A logarithm is only defined for positive values, so the axis range must not be negative: converting a value against a negative minimum or maximum throws IllegalStateException. A minimum of zero is tolerated but unhelpful, since zero is infinitely far from any positive value on this scale; start the range at a small positive number instead.

  • Konstruktordetails

    • LogarithmicRenderer2D

      public LogarithmicRenderer2D()
      Creates a new renderer for logarithmic scaled axes in two-dimensional space.
  • Methodendetails

    • worldToView

      public double worldToView(Axis axis, Number value, boolean extrapolate)
      Converts a world (axis) coordinate value to a view (screen) coordinate value.
      Parameter:
      axis - Axis
      value - World coordinate value to convert
      extrapolate - Option to activate extrapolation value that are not on the axis
      Gibt zurück:
      Screen coordinate value
    • viewToWorld

      public Number viewToWorld(Axis axis, double value, boolean extrapolate)
      Converts a view (screen) coordinate value to a world (axis) coordinate value.
      Parameter:
      axis - Axis
      value - View coordinate value to convert
      extrapolate - Option to activate extrapolation value that are not on the axis
      Gibt zurück:
      World coordinate value
    • getTicks

      public List<Tick> getTicks(Axis axis)
      Beschreibung aus Klasse kopiert: AbstractAxisRenderer2D
      Returns a list of all tick element on the axis.
      Angegeben von:
      getTicks in Schnittstelle AxisRenderer
      Setzt außer Kraft:
      getTicks in Klasse AbstractAxisRenderer2D
      Parameter:
      axis - Axis
      Gibt zurück:
      A list of Tick instances
    • createTicks

      protected void createTicks(List<Tick> ticks, Axis axis, double min, double max, Set<Double> tickPositions, boolean isAutoSpacing)
      Beschreibung aus Klasse kopiert: AbstractAxisRenderer2D
      Adds minor and major ticks to a list of ticks.
      Angegeben von:
      createTicks in Klasse AbstractAxisRenderer2D
      Parameter:
      ticks - List of ticks
      axis - Axis
      min - Minimum value of axis
      max - Maximum value of axis
      tickPositions - Set of tick positions
      isAutoSpacing - Use automatic scaling