Documentation of 'jhplot.HPlot3D' Java class.
HPlot3D
jhplot

Class HPlot3D

  • All Implemented Interfaces:
    java.awt.event.ComponentListener, java.io.Serializable, java.util.EventListener
    Direct Known Subclasses:
    SHPlot3D


    public class HPlot3D
    extends GHFrame
    Create a interactive canvas to show objects in 3D. Use it for showing 2D histograms (H2D class), functions (F2D), data points (P2D class) or more complicated surfaces (P3D class).
    See Also:
    Serialized Form
    • Field Detail

      • set

        public boolean set
    • Constructor Detail

      • HPlot3D

        public HPlot3D(java.lang.String title,
                       int xsize,
                       int ysize,
                       int n1,
                       int n2,
                       boolean set)
        Create interactive 3D canvas to display data.
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        n1 - number of plots/graphs in x
        n2 - number of plots in y
      • HPlot3D

        public HPlot3D(java.lang.String title,
                       int xsize,
                       int ysize,
                       int n1,
                       int n2)
        Create a 3D canvas to display data. Set is done by the default.
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        n1 - number of plots/graphs in x
        n2 - number of plots/graphs in y
        set - set or not the graph
      • HPlot3D

        public HPlot3D(java.lang.String title,
                       int xs,
                       int ys)
        Construct a 3D canvas with a single plot/graph
        Parameters:
        title - Title for the canvas
        xs - size in x
        ys - size in y
      • HPlot3D

        public HPlot3D(java.lang.String title)
        Construct a 3D canvas with a plot with the default parameters 600 by 400, and 10% space for the global title
        Parameters:
        title - Title
      • HPlot3D

        public HPlot3D()
        Construct a 3D canvas with a plot with the default parameters 600 by 400, and 10% space for the global title "Default"
    • Method Detail

      • resizePad

        public void resizePad(double widthScale,
                              double heightScale)
        Resize the current pad. It calculates the original pad sizes, and then scale it by a given factor. In this case, the pad sizes can be different.
        Parameters:
        widthScale - scale factor applied to the width of the current pad
        heightScale - scale factor applied the height of the current pad.
      • resizePad

        public void resizePad(int n1,
                              int n2,
                              double widthScale,
                              double heightScale)
        Resize the pad given by the inxX and indxY. It calculates the original pad sizes, and then scale it by a given factor. In this case, the pad sizes can be different.
        Parameters:
        n1 - the location of the plot in x
        n2 - the location of the plot in y
        widthScale - scale factor applied to the width of the current pad
        heightScale - scale factor applied the height of the current pad.
      • setDistance

        public void setDistance(double distance)
        Set distance to the object
        Parameters:
        distance - distance
      • getDistance

        public double getDistance()
        Get the distance
        Returns:
        distance
      • setScaling

        public void setScaling(double scale)
        Set the scaling
        Parameters:
        scale -
      • getScaling

        public double getScaling()
        Get the scaling
        Returns:
      • setRotationAngle

        public void setRotationAngle(double angle)
        Set the rotation angle.
        Parameters:
        angle - angle
      • getRotationAngle

        public double getRotationAngle()
        Get the rotation angle
        Returns:
        angle
      • setElevationAngle

        public void setElevationAngle(double angle)
        Set the elevation angle
        Parameters:
        angle - elevation angle
      • getElevationAngle

        public double getElevationAngle()
        Get the angle
        Returns:
      • setLabelFontColor

        public void setLabelFontColor(java.awt.Color fontColorLabel)
        Set color for labels
        Parameters:
        fontColorLabel -
      • update

        public void update(int n1,
                           int n2)
        Refresh only a particular plot
        Parameters:
        n1 - the location of the plot in x
        n2 - the location of the plot in y
      • updateData

        public void updateData(int n1,
                               int n2)
        Update data on the plot
        Parameters:
        n1 - the location of the plot in x
        n2 - the location of the plot in y
      • updateData

        public void updateData()
        Update data on the plot
      • getLabelOffset

        public double getLabelOffset(int axes)
        Get offset for labels on X
        Returns:
        axes 0 for X, 1 for Y, 2 for Z
      • updateAll

        public void updateAll()
        Refresh all the plots on the same canvas HPLOT
      • clear

        public void clear()
        Clear the current graph including graph settings. Note: the current graph is set by the cd() method
      • clear

        public void clear(int i1,
                          int i2)
        Clear the graph characterized by an index in X and Y. This method cleans the data and all graph settings.
        Parameters:
        i1 - location of the graph in X
        i2 - location of the graph in Y
      • setPenWidthAxes

        public void setPenWidthAxes(double w)
        Set line width to draw axes.
        Parameters:
        w - width of the lines
      • getPenWidthAxes

        public float getPenWidthAxes()
        Gets the pen width to draw axes.
        Returns:
        width of the lines
      • drawBox

        public void drawBox()
        Set drawiing an empty frame.
      • clearAll

        public void clearAll()
        Clear all graphs from data and settings.
      • quit

        public void quit()
        exit the frame and clear all components
      • visible

        public void visible(boolean vs)
        Set the canvas frame visible or not
        Parameters:
        vs - (boolean) true: visible, false: not visible
      • visible

        public void visible(int posX,
                            int posY)
        Set the canvas frame visible. Also set its location.
        Parameters:
        posX - - the x-coordinate of the new location's top-left corner in the parent's coordinate space;
        posY - - he y-coordinate of the new location's top-left corner in the parent's coordinate space
      • visible

        public void visible()
        Show the canvas
      • isSurface

        public boolean isSurface()
        Is the plot will be shown as a surface?
        Returns:
        true, if this is a surface plot
      • setNameX

        public void setNameX(java.lang.String a)
        Set a name for X axis
        Parameters:
        a - Name of the label for X axis
      • setNameY

        public void setNameY(java.lang.String a)
        Set a name for Y axis
        Parameters:
        a - Name of the label for Y axis
      • setNameZ

        public void setNameZ(java.lang.String a)
        Set a name for Z axis
        Parameters:
        a - Name of the label for Z axis
      • setLabelFont

        public void setLabelFont(java.awt.Font a)
        Set Font for the labels
        Parameters:
        a - Font
      • setAxisFont

        public void setAxisFont(java.awt.Font fontAxis)
        Sets font for axes
        Parameters:
        fontAxis - font
      • getAxisFont

        public java.awt.Font getAxisFont()
        Get font for axes
        Returns:
      • setLabelColor

        public void setLabelColor(java.awt.Color a)
        Set color of the label
        Parameters:
        a - Color
      • setColorLines

        public void setColorLines(java.awt.Color a)
        Set color of the lines to draw histogram bars
        Parameters:
        a - Color
      • setColorFill

        public void setColorFill(java.awt.Color a)
        Set color of to fill histogram bars
        Parameters:
        a - Color
      • setFill

        public void setFill(boolean fill)
        Set fill color or not for histogram bars
        Parameters:
        fill - if true, color will be set for the histogram bars
      • setTicFont

        public void setTicFont(java.awt.Font a)
        Set font for the ticks
        Parameters:
        a - Font
      • setDisplayXY

        public void setDisplayXY(boolean a)
        Display or not X and Y
        Parameters:
        a - true if it should be shown
      • setDivisions

        public void setDivisions(int v)
        Set number of divisions for surface plots
        Parameters:
        v - number of divisions in X and Y
      • setContourLines

        public void setContourLines(int v)
        Set number of divisions for contour plots
        Parameters:
        v - number of divisions in X and Y
      • setDisplayGrids

        public void setDisplayGrids(boolean a)
        Display grid
        Parameters:
        a - true if grid is displayed
      • setDisplayZ

        public void setDisplayZ(boolean a)
        Display or not title for Z
        Parameters:
        a - true, if it is shown
      • setContour

        public void setContour()
        Set contour style
      • setContour

        public void setContour(boolean a)
        Set contour style
        Parameters:
        a -
      • setDensity

        public void setDensity()
        Set density type of plot
      • setDensity

        public void setDensity(boolean a)
        Set density plot
        Parameters:
        a -
      • setSurface

        public void setSurface()
        Set surface type of plot
      • setSurface

        public void setSurface(boolean a)
        Set surface type of plot
      • setBars

        public void setBars()
        Set bar type of plot
      • setBars

        public void setBars(boolean a)
        Set bar type of plot
      • setBoxColor

        public void setBoxColor(java.awt.Color a)
        Set color of the box
        Parameters:
        a - Color
      • setFrameColor

        public void setFrameColor(java.awt.Color a)
        Set color of the frame
        Parameters:
        a - Color
      • setBoxed

        public void setBoxed(boolean boxed)
        Set boxed frame
        Parameters:
        boxed - true if it is boxed
      • getAxesFontColor

        public java.awt.Color getAxesFontColor()
        Color for tic labels
        Returns:
      • setAxesFontColor

        public void setAxesFontColor(java.awt.Color fontColorAxes)
        Get color for tic labels
        Parameters:
        fontColorAxes - color
      • getFrameColor

        public java.awt.Color getFrameColor()
        Get color of the frame
        Returns:
        a Color
      • setColorMode

        public void setColorMode(int a)
        Sets the color mode
        Parameters:
        a - color modes:

        0: WIREFRAME
        1: HIDDEN
        2: SPECTRUM IN COLOR
        3: GRAYSCALE
        4: DUALSHADES
        5: FOG
        6: MESH

      • getSurfaceModel

        public jplot3d.SurfaceModelCanvas getSurfaceModel()
        Get current surface
        Returns:
      • getColorMode

        public int getColorMode()
        Get current the color mode
        Parameters:
        a - color modes:

        0: WIREFRAME
        1: HIDDEN
        2: SPECTRUM IN COLOR
        3: GRAYSCALE
        4: DUALSHADES
        5: FOG
        6: MESH

      • getLabelColor

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

        public void update()
        Update the graphics
      • setTicOffset

        public void setTicOffset(double a)
        Set tick offset
        Parameters:
        a - tick offset
      • setLabelOffsetX

        public void setLabelOffsetX(double a)
        Set label offset on X
        Parameters:
        a - label offset
      • setLabelOffsetY

        public void setLabelOffsetY(double a)
        Set label offset on Y
        Parameters:
        a - label offset
      • setLabelOffsetZ

        public void setLabelOffsetZ(double a)
        Set label offset on Z
        Parameters:
        a - label offset
      • setRange

        public void setRange(double Xmin,
                             double Xmax,
                             double Ymin,
                             double Ymax)
        Set X and Y range for the 3D plot. Z is set to autorange.
        Parameters:
        Xmin - Min in X
        Xmax - Max in X
        Ymin - Min in Y
        Ymax - Max in Y
      • setRange

        public void setRange(double Xmin,
                             double Xmax,
                             double Ymin,
                             double Ymax,
                             double Zmin,
                             double Zmax)
        Set X, Y, Z ranges for the 3D plot
        Parameters:
        Xmin - Min in X
        Xmax - Max in X
        Ymin - Min in Y
        Ymax - Max in Y
        Zmin - Min in Z
        Zmax - Max in Z
      • setRangeZ

        public void setRangeZ(double Zmin,
                              double Zmax)
        Sets the z range of calculated surface vertices. The ranges will not affect surface appearance. They affect axes scale appearance.
        Parameters:
        Zmin - the minimum z
        Zmax - the maximum z
      • draw

        public void draw(H2D f1)
        Draw H2D histogram. By default, we shows it as bars. Call setSurface() to show it as a surface.
        Parameters:
        f1 - H2D histogram
      • draw

        public void draw(H2D[] d)
        Draw array of histograms
        Parameters:
        d - array of histograms
      • draw

        public void draw(P2D h1)
        Display P2D data holder with X,Y,Z values in 3D. If setSurface applied, it will draw the surface.
        Parameters:
        h1 - P2D data holder
      • draw

        public void draw(P2D[] d)
        Draw array of P2D holders
        Parameters:
        d - array of P2D data holders
      • setAutoRange

        public void setAutoRange(boolean b)
        Set autorange in X,Y,Z.
        Parameters:
        b - if true, sets autorange
      • setAutoRangeAll

        public void setAutoRangeAll(boolean b)
        Set to autorange all pads
        Parameters:
        b -
      • setAutoRange

        public void setAutoRange()
        Set autorange in X,Y,Z at the same time for the current plot
      • setAutoRangeXY

        public void setAutoRangeXY()
        Set autorange in Y,Z at the same time for the current plot
      • draw

        public void draw(P3D h)
        Display P3D data holder with X,Y,Z values in 3D as surface. If setSurface applied, it will draw the surface
        Parameters:
        h - P3D data holder.
      • draw

        public void draw(P3D[] d)
        Draw array of P3D holders
        Parameters:
        d - array of P3D data holders
      • draw

        public void draw(H2D h1,
                         H2D h2)
        Plot two H2D histograms on the same plot. When only one histogram is plotted, i.e. h2=null, then the bar option is used. If two histograms are plotted, the surface option is used (in this case the numbers of bins in X and Y should be the same.
        Parameters:
        h1 - first H2D histogram
        h2 - second H2D histogram
      • draw

        public void draw(F2D f1)
        Draw F2D function as a surface.
        Parameters:
        f1 - F2D function
      • draw

        public void draw(F2D f1,
                         F2D f2)
        Draw two F2D functions on the same plot. The bar option is not supported, i.e. the functions will be shown by surface.
        Parameters:
        f1 - first F2D function
        f2 - second F2D function
      • draw

        public void draw(H2D h1,
                         F2D h2)
        Draw H2D histogram and F2D function on the same plot. Note: the bar option for histogram is not supported. In addition, the number of bins in X and Y should be the same.
        Parameters:
        h1 - H2D histogram
        h2 - F2D function
      • draw

        public void draw(F2D h2,
                         H2D h1)
        Draw F2D and H2D on the same plot.
        Parameters:
        h2 - F2D function
        h1 - H2D histogram
      • close

        public void close()
        Close the canvas (and dispose all components) Note: a memory leak is found - no time to study it. set to null all the stuff
      • doc

        public void doc()
        Show online documentation.

DMelt 3.0 © DataMelt by jWork.ORG