Documentation of 'jhplot.HPlotXY' Java class.
HPlotXY
jhplot

Class HPlotXY



  • public class HPlotXYextends Object
    Create a plot in X-Y. This canvas is similar to HPlot, but it uses the API based on JPlot2D program for a high-performance multi-threaded 2d plot library which produces publication quality plots. It can be used for scatter plot, line chart, staircase chart, linear axis and logarithmic axis,plot can contains subplots * unlimited undo/redo.
    • Constructor Detail

      • HPlotXY

        public HPlotXY(String title,               int xsize,               int ysize,               boolean set)
        Create canvas with a certain size.
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        set - if true, we preset all graphics options. If false, only the most basic options are created and the user should design the plots yourself.
      • HPlotXY

        public HPlotXY(String title,               int xsize,               int ysize)
        Create a plotting canvas.
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
      • HPlotXY

        public HPlotXY(boolean set)
        Create canvas for custom plots.
        Parameters:
        title - Title
        set - if false, a user should create a custom canvas.
      • HPlotXY

        public HPlotXY(String title)
        Construct a HPlotXY canvas with a plot with the size 600x400.
        Parameters:
        title - Title
      • HPlotXY

        public HPlotXY()
        Construct a HPlotXY canvas with a single plot with the size 600x400.
    • Method Detail

      • setNameX

        public void setNameX(String s)
        Sets the name for X axis. The color is black.
        Parameters:
        s - Title for X axis.
      • setNameY

        public void setNameY(String s)
        Sets the name for Y axis. The color is black.
        Parameters:
        s - Title for Y axis.
      • setGTitle

        public void setGTitle(String sname,                      Font f,                      Color c)
        Set global title and its attributes
        Parameters:
        sname - name
        f - font
        c - color
      • setGTitle

        public void setGTitle(Title title)
        Set title as an object.
        Parameters:
        title -
      • setGTitle

        public void setGTitle(String sname,                      Color c)
        Set the global title with default attributes. The default font is ("Arial", Font.BOLD, 18)
        Parameters:
        sname - Title
        c - color
      • setGTitle

        public void setGTitle(String sname)
        Set the global title with default attributes.
        Parameters:
        sname - Title
      • setRangeX

        public void setRangeX(double min,                      double max)
        Sets the range (min-max) displayed on X
        Parameters:
        min - minimum value on the axis
        max - maximum value on the axis
      • setRangeY

        public void setRangeY(double min,                      double max)
        Sets the range (min-max) displayed on Y
        Parameters:
        min - minimum value on the axis
        max - maximum value on the axis
      • setRange

        public void setRange(double minX,                     double maxX,                     double minY,                     double maxY)
        Sets the range for the current plot
        Parameters:
        minX - Min value in X
        maxX - Max value in X
        minY - Min value in Y
        maxY - Max value in Y
      • getAxis

        public Axis getAxis(int axis)
        Get the axis object.
        Returns:
        type of the axis.
        0: X axis (bottom)
        1: Y axis (left)
        10: Top X axis
        11: Right Y axis
      • setAxis

        public void setAxis(Axis xaxis,                    Axis yaxis)
        Set axis
        Parameters:
        xaxis - Y-axis
        yaxis - Y-axis
      • setLogScale

        public void setLogScale(int axis,                        boolean b)
        Sets true or false to plot on a log scale.
        Parameters:
        axis - defines to which axis this function applies. 0 means X, 1 means Y.
        b - toggle, true if the scaling is logarithmic
      • 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()
        Set the canvas frame visible
      • update

        public void update()
        Update the current canvas.
      • export

        public void export(String file)
        Fast export of the canvas to an image file. This depends on the extension:
        SVG - Scalable Vector Graphics (SVG)
        SVGZ - compressed SVG
        PNG - raster format
        PDF - PDF
        EPS - PostScript (encapsulated)

        No questions will be asked and existing file will be rewritten

        Parameters:
        file - Output file with the proper extension (SVG, SVGZ, PNG, PDF, EPS). If no extension, PNG file is assumed.
      • doc

        public void doc()
        Show online documentation.
      • getTitle

        public String getTitle()
        Return title of this plotter.
        Returns:
      • close

        public void close()
        Close the canvas (and dispose all components).
      • draw

        public void draw(XYGraph xl)
        Draw an arbitrary graph.
        Parameters:
        xl -
      • draw

        public XYGraph draw(H1D histogram)
        Plot 1D histogram. Use graphical options of H1D histogram to use some style.
        Parameters:
        histogram - input H1D histogram
        Returns:
        Graph to style
      • draw

        public XYGraph draw(P1D p1d)
        Draw P1D array with errors.
        Parameters:
        p1d - P1D array with errors
        graph - to style;
      • draw

        public XYGraph draw(double[] x,                    double[] y,                    String name)
        Plot X-Y data
        Parameters:
        x - X array
        y - Y array
        Returns:
        Graph to for styling.
      • getPlot

        public Plot getPlot()
        Return the plotting area.
        Returns:
        actual plot.
      • getPanel

        public JPlot2DComponent getPanel()
        Get drawing panel.
        Returns:
        panel with image
      • getFrame

        public JFrame getFrame()
        Get grame that keeps averything
        Returns:
        panel with image
      • getFactory

        public ElementFactory getFactory()
        Get drawing factory for custom plots.
        Returns:
        drawing factory.
      • getEnv

        public RenderEnvironment getEnv()
        Get drawing factory for custom plots.
        Returns:
        drawing environment.
      • getLayer

        public Layer getLayer()
        Get drawing layer.
        Returns:
        drawing factory.
      • draw

        public XYGraph draw(F1D f1d)
        Draw a function. F1D should be created from AIDA. If You set range during F1D initialization, it will be used. If not, canvas range is used.
        Parameters:
        f1d - input function;
        Returns:
        Graphs that can be styled.

DMelt 2.7 © DataMelt by jWork.ORG