Documentation of 'jhplot.jadraw.JaAxes' Java class.
JaAxes
jhplot.jadraw

Class JaAxes

  • All Implemented Interfaces:
    java.io.Serializable


    public class JaAxes
    extends JaFillObject
    Main class to build a pad with axes, ticks, labels.
    See Also:
    Serialized Form
    • Constructor Detail

      • JaAxes

        public JaAxes(int padX,
                      int padY)
        Constructor: sets the width, height, getRelw() and getRelh() to a default value of 25.
    • Method Detail

      • isGridFront

        public boolean isGridFront()
        is grid should be shown in front of all drawn objects?
        Returns:
        true if grid in front
      • setGridFront

        public void setGridFront(boolean isGridFront)
        Set grid to be drown in fron of all graphic objects
        Parameters:
        isGridFront - true, if in front
      • setBackgroundColor

        public void setBackgroundColor(java.awt.Color bkgColor)
        Set background color
        Parameters:
        color - for background
      • getBackgroundColor

        public java.awt.Color getBackgroundColor()
        Get background color (white is default)
        Returns:
        color
      • getMarginLeft

        public double getMarginLeft()
        Get left margin
        Returns:
        left margin size
      • getMarginRight

        public double getMarginRight()
        Get right margin
        Returns:
        right margin
      • getMarginTop

        public double getMarginTop()
        Get top margin
        Returns:
        top margin size
      • getMarginBottom

        public double getMarginBottom()
        Get bottom margin
        Returns:
        size of bottom margin
      • setExpForm

        public void setExpForm(int expForm)
        Set exponential form. By deafult, if the number is larger than 1000, it will be shown using exponent.
        Parameters:
        expForm -
      • getExpForm

        public int getExpForm()
        Get exponential form
        Returns:
      • setLabelSpace

        public void setLabelSpace(int axis,
                                  double labelSpace)
        Set a space between axis and labels for ticks
        Parameters:
        axis - axis (0: for X or 1: for Y)
        labelSpace - space in NDC (0-1)
      • getLabelSpace

        public double getLabelSpace(int axis)
        Get label space
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        space
      • setGridColor

        public void setGridColor(java.awt.Color gridColor)
        Set grid color
        Parameters:
        gridColor - color used to draw grid
      • setSubTicksNumber

        public void setSubTicksNumber(int axis,
                                      int maxSubTicks)
        Set the number of sub-ticks
        Parameters:
        axis - axis (0: for X or 1: for Y)
        maxSubTicks - max number of subticks
      • setTicksNumber

        public void setTicksNumber(int axis,
                                   int maxTicks)
        Set the number of main ticks. Usually, the program tries to find the best number, so the actual number of main ticks can be less
        Parameters:
        axis - axis (0: for X or 1: for Y)
        maxTicks - max number of tics
      • setShowGrid

        public void setShowGrid(int axis,
                                boolean showGrid)
        Is grid to be shown?
        Parameters:
        axis - axis (0: for X or 1: for Y)
        showGrid - true if shown.
      • setShow

        public void setShow(int axis,
                            boolean show)
        Set true if you want to show a particular axis
        Parameters:
        axis - axis (0: for X or 1: for Y) to be shown
        show - set true if the axis should be drawn
      • setShowMirror

        public void setShowMirror(int axis,
                                  boolean showMirror)
        Set true if a mirror axis to be shown
        Parameters:
        axis - axis (0: for X or 1: for Y)
        showMirror - true if mirror axis will be shown
      • setTicksSize

        public void setTicksSize(int axis,
                                 double ticsSize)
        Set the size of the ticks in NDC format.
        Parameters:
        axis - axis (0: for X or 1: for Y)
        ticsSize - tick size in NDC form
      • setSubTicksSize

        public void setSubTicksSize(int axis,
                                    double subTicsSize)
        Set the size of subtics in NDC
        Parameters:
        axis - axis (0: for X or 1: for Y)
        subTicsSize - subtick size
      • setLabelColor

        public void setLabelColor(java.awt.Color labelColor)
        Set the color for labels indicating the ticks
        Parameters:
        labelColor - color
      • getLabelColor

        public java.awt.Color getLabelColor()
        Get label color
        Returns:
        color
      • setLabelFont

        public void setLabelFont(java.awt.Font labelFont)
        Set label fonts
        Parameters:
        labelFont - font
      • getLabelFont

        public java.awt.Font getLabelFont()
        Get label font
        Returns:
        font
      • setLabelRotation

        public void setLabelRotation(double labelRotation)
        Set rotation for labels
        Parameters:
        labelRotation -
      • getLabelRotation

        public double getLabelRotation()
        Get label rotation
        Returns:
        rotation
      • setPad

        public void setPad(int axis,
                           int pad)
        Set pad ID
        Parameters:
        axis - axis axis (0: for X or 1: for Y)
        pad - pad ID
      • getPad

        public int getPad(int axis)
        Get ID of the current pad
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        pad ID
      • getGridColor

        public java.awt.Color getGridColor()
        Get grid color (gray is default)
        Returns:
        color
      • getRotateTicks

        public boolean getRotateTicks(int axis)
        Set true if ticks should be rotated
        Parameters:
        axis -
        Returns:
      • setRotateTicks

        public void setRotateTicks(int axis,
                                   boolean angle)
        Set true if ticks should be rotated
        Parameters:
        axis - axis (0: for X or 1: for Y)
        angle - angle
      • getSubTicksNumber

        public int getSubTicksNumber(int axis)
        Get the number of sub-ticks
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        number of sub-ticks
      • getTicksNumber

        public int getTicksNumber(int axis)
        Get number of main ticks
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        number of main ticks
      • getSubTicksSize

        public double getSubTicksSize(int axis)
        Get sub-tick size
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        size
      • getTicksSize

        public double getTicksSize(int axis)
        Get subtick size
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        size
      • getAxesArrow

        public int getAxesArrow(int axis)
        Is arrow to be shown
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        error type
      • setAxesArrow

        public void setAxesArrow(int axis,
                                 int type)
        Set arrow type
        Parameters:
        axis - axis (0: for X or 1: for Y)
        type - of arrow
      • isTicksLabels

        public boolean isTicksLabels(int axis)
        Is ticks should be drawn
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
      • setTicksLabels

        public void setTicksLabels(int axis,
                                   boolean draw)
        Set or not tick labels
        Parameters:
        axis - axis (0: for X or 1: for Y)
        draw - true if shown
      • isShowKey

        public boolean isShowKey()
        is key should be shown?
        Returns:
        true if shown
      • setShowKey

        public void setShowKey(boolean show)
        Set true if keys are shown
        Parameters:
        show -
      • isShow

        public boolean isShow(int axis)
        Is a particular axis should be shown?
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        true if shown
      • isShowGrid

        public boolean isShowGrid(int axis)
        Is grid to be shown?
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        true if shown
      • isShowMirror

        public boolean isShowMirror(int axis)
        Is axis mirror is shown?
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
        true if shown
      • axisExponent

        public java.lang.String axisExponent(int axis)
        Get exponent for the axis
        Parameters:
        axis - axis (0: for X or 1: for Y)
        Returns:
      • setContour

        public void setContour(boolean isContour)
        Set the contour style and parse the data.
        Parameters:
        isContour - true if contour style is set.
      • isContour

        public boolean isContour()
        Is contour plot shown?
        Returns:
        true if shown
      • setContourBar

        public void setContourBar(boolean bar)
        Show or not a bar with color levels
        Parameters:
        bar - true if the bar is shown
      • isContourBar

        public boolean isContourBar()
        is a bar showing levels should be shown?
        Returns:
      • getContourBinX

        public int getContourBinX()
        Get number of bins in X for contour plot
        Returns:
        number of bins in X
      • getContourBinY

        public int getContourBinY()
        Get number of bins in Y for contour plot
        Returns:
        number of bins in Y
      • getContourLevels

        public int getContourLevels()
        Get the number of levels to show contour plot
        Returns:
        number of levels
      • setStatistics

        public void setStatistics(java.lang.String[] s)
        Set a strings representing the full statistics
        Parameters:
        s - strings with statistics
      • getStatistics

        public java.lang.String[] getStatistics()
        Get strings representing the statistics of the object
        Returns:
        statistics
      • setContourLevels

        public void setContourLevels(int levels)
        How many color levels should be shown (10 default)
        Parameters:
        levels - number of color levels
      • setContourBins

        public void setContourBins(int binsX,
                                   int binsY)
        How many bins used to slice the data in X (and Y)
        Parameters:
        binsX - number of bins in X
        binsY - number of bins in Y
      • setContourGray

        public void setContourGray(boolean gray)
        Color style to show contour plot. The default is color style.
        Parameters:
        gray - set to true to show in black-white
      • setData

        public void setData(java.util.Vector<jplot.DataArray> data)
        Set data in form of vector
        Parameters:
        data - input data
      • toX

        public int toX(double x)
        Convert the user coordinate X to the pixel coordinate
        Parameters:
        x - user coordinate X for conversion
      • toUserX

        public double toUserX(int Xpic)
        Move to User coordinates
        Parameters:
        Xpic -
        Returns:
      • toY

        public int toY(double y)
        Convert the user coordinate Y to the pixel coordinate
        Parameters:
        y - user coordinate Y for conversion
      • toUserY

        public double toUserY(int Ypic)
        Move to User coordinates
        Parameters:
        Ypic -
        Returns:
      • setTicLabel

        public void setTicLabel(java.lang.String[][] ticLabel)
      • getTicLabel

        public java.lang.String[][] getTicLabel()
      • setLogScale

        public void setLogScale(int axis,
                                boolean set)
        Sets true or false to plot on a log scale.
        Parameters:
        axis - defines to which axis this function applies (0 if X, 1 if Y).
        b - toggle, true if the scaling is logarithmic
      • isLogScale

        public boolean isLogScale(int axis)
      • setAutoRange

        public void setAutoRange(int axis,
                                 boolean autoRange)
        Set autorange for a particular axis
        Parameters:
        axis - axis (0: for X and 1: for Y)
        autoRange - true if autorange
      • setAutoRange

        public void setAutoRange()
        Set auto-range on all axes
      • isAutoRange

        public boolean isAutoRange(int axis)
        Is the graph axis were done with the aoutorange option?
        Parameters:
        axis - axis (0: for X and 1: for Y)
        Returns:
        true if autorange is set
      • setRange

        public void setRange(int axis,
                             double minValue,
                             double maxValue)
        Set the ranges for the current pad
        Parameters:
        axis - axis (0: for X and 1: for Y)
        minValue - min value
        maxValue - max value
      • setMax

        public void setMax(int axis,
                           double value)
        Set min values
        Parameters:
        axis - axis (0: for X and 1: for Y)
        value - min value
      • setMin

        public void setMin(int axis,
                           double value)
        Set max value
        Parameters:
        axis - axis (0: for X and 1: for Y)
        value - max value
      • getMax

        public double getMax(int axis)
        Get max value
        Parameters:
        axis - axis (0: for X and 1: for Y)
        Returns:
        max value
      • getMin

        public double getMin(int axis)
        Get min value
        Parameters:
        axis - axis (0: for X and 1: for Y)
        Returns:
        min value
      • copy

        public final JaObject copy()
        Returns an exact copy of this Label.
        Specified by:
        copy in class JaObject
        Returns:
        A copy of this Label.
      • isCopy

        public final boolean isCopy(JaObject comp)
        Returns true if all serializable variables of this JaObject and those of the specified one are equal.
        Specified by:
        isCopy in class JaObject
        Parameters:
        comp - A JaObject to compare with.
        Returns:
        True if the objects are equal, false otherwise.
      • getGrabbedHandle

        public final int getGrabbedHandle(int clickX,
                                          int clickY,
                                          int editmode)
        Determines where on this JaObject a mouse click has ocurred.
        Specified by:
        getGrabbedHandle in class JaObject
        Parameters:
        clickX - The x position of the point where the mouse click ocurred.
        clickY - The y position of the point where the mouse click ocurred.
        editmode - The current edit mode as defined in JaxoMainPanel.
        Returns:
        An integer specifying whether the click ocurred on one of the handles and if yes, on which.
      • drawHandles

        public final void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
        Draws the handles of this box object.
        Specified by:
        drawHandles in class JaObject
        Parameters:
        g2 - The current graphics context.
      • getLabelDimension

        public void getLabelDimension(java.awt.FontMetrics fmX,
                                      int axis)
        Get the lastst lavel size
      • getData

        public java.util.Vector<jplot.DataArray> getData()
        Get the vector which keeps all the data
        Returns:
        Vector with the data
      • getNumDigits

        public int getNumDigits(double num)
        Return the number of digits required to display the given number. If more than 15 digits are required, 15 is returned).
      • formatNumber

        public java.lang.String formatNumber(double num,
                                             int n)
        formats a double precision number such that it is correctly rounded for output. Kind of pre-processor for all number for output.
        Parameters:
        num - number to be formatted
        n - number of digits (accuracy) after the decimal point.
        Returns:
        the formatted number in a string.
      • jaxoDraw

        public final void jaxoDraw(org.freehep.graphics2d.VectorGraphics g2,
                                   boolean drawToScreen)
        The method that draws this Jaxo Axes.
        Specified by:
        jaxoDraw in class JaObject
        Parameters:
        g2 - The graphics context where the JaAxes has to be drawn.
        drawToScreen - A boolean variable that indicates whether the drawing is done on the screen or somewhere else. This is used for exporting/printing, where the object handles should not be painted, even if they are visible on the screen.
      • latexCommand

        public final java.lang.String latexCommand(float scale,
                                                   java.awt.Dimension canvasDim)
        The LaTeX command that is necessary to draw the given JaAxes using the axodraw.sty package.
        Specified by:
        latexCommand in class JaObject
        Parameters:
        scale - A scale factor to translate Java coordinates to LaTeX coordinates.
        canvasDim - The current dimension of the canvas.
        Returns:
        The corresponding axodraw LaTeX command.
      • rescaleObject

        public final void rescaleObject(int orx,
                                        int ory,
                                        float scale)
        Rescales this JaAxes by the scale factor scale, keeping the point (orx, ory) fixed.
        Specified by:
        rescaleObject in class JaObject
        Parameters:
        orx - The x - coordinate of the fixed point
        ory - The y - coordinate of the fixed point
        scale - The scale parameter
      • addData

        public void addData(jplot.DataArray d,
                            int plotType)
        Add data to this plot.
        Parameters:
        d -
        plotType - current plottype
      • addData

        public void addData(H2D h2d,
                            int plotType)
        Add h2d data set.
        Parameters:
        h2d -
      • parseContour

        public void parseContour()
        Prepare a contour plot
      • parseH2D

        public void parseH2D()
        Prepare a contour plot to display H2D histograms
      • clear

        public void clear()
        Clear.
      • getPlotType

        public int getPlotType()
      • drawData

        public void drawData(org.freehep.graphics2d.VectorGraphics g2)
        Draw data points
      • getPoints

        public java.util.Vector<jplot.PlotPoint> getPoints(jplot.DataArray da)
      • getPointsNoCuts

        public java.util.Vector<jplot.PlotPoint> getPointsNoCuts(jplot.DataArray da)
      • drawMargins

        public void drawMargins(org.freehep.graphics2d.VectorGraphics g2)
      • editPanel

        public final boolean editPanel()
        Brings up the edit panel that allows to change the parameters of this object.
        Specified by:
        editPanel in class JaObject
        Returns:
        True if the editing actually changed the object, false if the object has not been changed.

DMelt 3.0 © DataMelt by jWork.ORG