jhplot
Class HPlot
- java.lang.Object
-
- jhplot.gui.GHPanel
-
- jhplot.gui.GHFrame
-
- jhplot.HPlot
-
- All Implemented Interfaces:
- java.awt.event.ComponentListener, java.io.Serializable, java.util.EventListener
- Direct Known Subclasses:
- SHPlot
public class HPlot extends GHFrame implements java.io.Serializable
HPlot class to create a canvas with several plots. This class is 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. All data types of DataMelt are supported.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HPlot()
Construct a HPlot canvas with a single plot with the size 600x400.HPlot(java.lang.String title)
Construct a HPlot canvas with a plot with the size 600x400.HPlot(java.lang.String title, int xs, int ys)
Construct a HPlot canvas with a single plot.HPlot(java.lang.String title, int xs, int ys, boolean set)
Construct a HPlot canvas with a single plot.HPlot(java.lang.String title, int xsize, int ysize, int n1, int n2)
Create HPlot canvas with several plots.HPlot(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean set)
Create HPlot canvas with several plots.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
add(HKey label)
Add a key to the Canvas.void
add(HLabel label)
Add a label to the Canvas.void
add(HLabelEq ob)
Add a LaTeX equation to the canvas.void
add(HMLabel label)
Add a multiline label to the Canvas.void
add(HShape ob)
Add a shape primitive to the Canvas.IAnalysisFactory
analF()
Return IAnalysisFactory associated with the plotdouble
axisLengthX()
Length of X axis in pixels.double
axisLengthY()
Length of Y axis in pixels.void
clear()
Clear the current graph including graph settings.void
clear(int i1, int i2)
Clear the graph characterised by an index in X and Y.void
clearAll()
Clear all graphs from data and settings.void
clearAllData()
Clear all graphs from the input data.void
clearAllLabels()
Clear all graph labelsvoid
clearData()
Clear the current graph from the input data.void
clearData(int i)
Remove one data set from the current plot.void
clearData(int i1, int i2)
Clear data of the graph characterised by an index in X and Y.void
clearLabels()
Clear graph labels for the curent graph.void
clearLabels(int i1, int i2)
Clear Graph settings including labels.void
close()
Close the canvas (and dispose all components).void
distroy()
Remove the canvas framevoid
doc()
Show online documentation.void
draw(Cloud1D c1d)
Plot cloud in 1D.void
draw(Cloud2D c2d)
Plot cloud 2Dvoid
draw(jplot.DataArray inputDA, int index)
Draw input data represented by DataArrayvoid
draw(DataPointSet ds)
Plot Aida datapointset.boolean
draw(F1D f1)
Draw an one-dimensional function.void
draw(F1D[] f)
Draw array of F1D holdersboolean
draw(F1D f1, boolean startZero)
Draw an one-dimensional function.boolean
draw(F1D f1, double min, double max)
Draw a function in a range.boolean
draw(FND f1)
Draw an one-dimensional function from FNDboolean
draw(FND f1, boolean startZero)
Draw an one-dimensional function from FND.void
draw(H1D h1)
Plot 1D histogram.void
draw(H1D[] h1)
Draw array of histogramsvoid
draw(Histogram1D h1d)
Draw 1D histogramvoid
draw(HKey label)
Draw a key.void
draw(HLabel label)
Draw a label.void
draw(HLabelEq ob)
Draw a LaTeX rquation on the Canvas.void
draw(HMLabel ob)
Draw a multiline label.void
draw(HShape ob)
Draw a shape primitive to the Canvas.void
draw(P1D d)
Draw data in form of P1Dvoid
draw(P1D[] d)
Draw array of P1D holdersvoid
drawStatBox(H1D h1)
Draw a statistical box (mean, RMS, number of entries)void
drawStatBox(H1D h1, double x, double y, java.lang.String howToSet)
Draw a statistical box (mean, RMS, number of entries) at a specific position.void
drawStatBox(H1D h1, int x, int y)
Draw a statistical box (mean, RMS, number of entries) at a specific position.void
drawTextBox(java.lang.String[] lines)
Draw a text box with some informationvoid
factories()
Create various JAIDA factories: IAnalysisFactory, ITree, IFitFactory, IFunctionFactoryint
fit(H1D h1, java.lang.String predefFunc, java.lang.String method)
Fit 1D histogram with the function F1DIFitFactory
fitF()
Return FitFactory associated with the plotIFunctionFactory
funcF()
Return FunctionFactory associated with the plotboolean
getAntiAlias()
Get antialiasing for the graphics of the current plotjava.awt.Color
getAxesColor()
Returns the actual color of the axes of the graph.double
getAxesRatio()
Returns the current ratio between X- and Y-axes lengths.boolean
getAxesRatioUse()
Says whether we should use a fixed ratio between X- and Y-axes lengths.int
getAxisArrow()
Gets axis arrows.int
getAxisPenTicWidth()
Get the pen width to draw tick axesjava.awt.Color
getBackgColor()
Returns the actual background color of the entire graph panel.java.awt.Color
getBackgColorGraph()
Returns the background color of the current graph.java.awt.Color
getBoxColor()
Returns the color used to draw the bounding box.java.awt.Color
getBoxFillColor()
Returns the fill-color of the eventual bounding box arround the graphfloat
getBoxOffset()
Returns the offset of the bounding box.java.util.Vector<jplot.DataArray>[][]
getData()
Get the vector which keeps all the datajplot.GraphSettings
getGraphSettings()
Get graph settings for current plotjplot.GraphSettings
getGraphSettings(int n1, int n2)
Get graph settingsjava.awt.Color
getGridColor()
Sets the color of the overall grid.java.awt.Color
getInnerColor()
Returns the color used to fill the shaded triangles.jplot.JPlot
getJPlot()
Get jplots for each graph for current graphjplot.JPlot
getJPlot(int n1, int n2)
Get jplots for each graphjava.awt.Font
getLegendFont()
Returns the font used by the legend.double
getLegendPos(int axis)
Returns the x or y coordinates (defined in pixels, relative to the size of the panel showing the graph) of the legend.boolean
getLegendPosUse()
Returns whether or not we use the legend coordinates.double
getLegendSpacing()
Returns the vertical spacing, between each line of the legend.double
getMarginBottom()
Returns the distance between the bottom-border of the panel and the bottom X-axis.double
getMarginLeft()
Returns the distance between the left-border of the panel and the left Y-axis.double
getMarginRight()
Returns the distance between the right-border of the panel and the right Y-axis.double
getMarginTop()
Returns the distance between the top-border of the panel and the top X-axis.int
getMaxNumberOfSubticsLog()
Returns the maximum number of subticks for log scale (default is 10).double
getMaxValue(int axis)
Returns the maximum data value for the specified axis.double
getMinValue(int axis)
Returns the minimum data value for the specified axis.int
getNumberOfTics(int axis)
Returns the number of ticks for the specified axis.java.awt.Dimension
getPanelSize()
Returns the dimensions of the panel used to display the graph.double
getPenWidthAxis()
Get pen width to draw axisboolean
getShadow()
Returns whether or not a shadow will be drawn at the panel border.double
getSubTicLength(int axis)
Returns the length of the sub-ticks.void
getSubTicNumber(int axis)
Get the number of subticks for a given axisjava.awt.Color
getTicColor(int axis)
Returns the color used by the labels drawn at each tick.java.awt.Font
getTicFont(int axis)
Returns the font used by the labels drawn at each tick.double
getTicLength(int axis)
Returns the length of the ticks.boolean
getTicsMirror(int axis)
Returns whether or not we should draw ticks on the mirror axis.boolean
getTicsRotate(int axis)
Returns whether or not we should rotate the ticks.IHistogramFactory
histF()
Return IHistogramFactory associated with the plotboolean
isAxisShown(int axis)
Returns whether an axis line will be drawn or not.boolean
isGridToFront()
Flag, saying whether the grid should be drawn at the foreground or not.boolean
isMirrorAxisShown(int axis)
Returns whether the mirror of an axis will be drawn or not.boolean
isPrimitivesToFront()
Flag, saying whether primitives should be drawn at the foreground or not.boolean
isTicLabelsShown(int axis)
Returns whether or not to draw the tick labelsboolean
isTicsShown(int axis)
Returns whether or not to draw ticks (little lines on the axes).int
numberLabels()
No labels on the current plot.int
numberPrimitives()
No of primitives for the current plot.void
printGraphSettings()
Print the current graph settings to System.outvoid
printGraphSettings(java.io.PrintStream out)
Print the current graph settings to System.outvoid
quit()
Quit the canvas (and dispose all components) Note: a memory leak is found - no time to study it.void
read(java.lang.String file)
Read HPlot file and inserts graphs to the main frame.void
refreshFrame()
Refresh all the framesvoid
removeAxes()
Remove X and Y axes, ticks, axis labels on the current plot.void
removeGraph()
Remove all components from the JHPlot frame.void
removeLabel(int i)
remove i-th HLabel or HMLabel on the current plotvoid
removeLabels()
remove HLabels and HMLabels on the current plotvoid
removeLabelsAll()
remove all Labels on all plots.void
removePrimitives()
remove 2D java primitives on the current plotvoid
removePrimitives(int i)
remove i-th 2D java primitives on the current plotvoid
removePrimitivesAll()
remove all 2D java primitivesvoid
resetStyle()
Resets the current plot settings to default values.void
resetStyleAll()
Resets all plot settings to default values.void
resizePad(double widthScale, double heightScale)
Resize the current pad.void
resizePad(int n1, int n2, double widthScale, double heightScale)
Resize the pad given by the inxX and indxY.void
setAntiAlias(boolean setit)
Set antialiasing for the graphics of the current plotvoid
setAntiAliasAll(boolean setit)
Set antialiasing for the graphics of all plotsvoid
setAttResizable(boolean resizable)
Set canvas attributes resizable (line widths, symbols, fonts) or not.void
setAttResizableAll(boolean resizable)
Set canvas attributes resizable (line widths, symbols, fonts) or not.void
setAutoRange()
Set autorange in X and Y at the same time for the current plotvoid
setAutoRange(boolean b)
Set autorange in X and Y at the same timevoid
setAutoRange(int axis, boolean b)
Sets true or false to use automatic scaling for the current plot.void
setAutoRangeAll()
Set autorange in X and Y at the same time for all plotsvoid
setAutoRangeAll(boolean b)
Set auto-range in X and Y at the same time for all plotsvoid
setAutoRangeAll(int axis, boolean b)
Sets true or false to use automatic scaling for all plots.void
setAxesColor(java.awt.Color color)
Sets the actual color of the axes of the graph.void
setAxesRatio(double r)
Sets the ratio between X- and Y-axes lengths.void
setAxesRatioUse(boolean b)
Sets whether or not to use a fixed ratio between X- and Y-axes lengths.void
setAxis(int axis, boolean b)
Sets whether an axis line will be drawn or not.void
setAxisAll(boolean b)
Sets whether all axis lines will be drawn or not.void
setAxisArrow(int type)
Sets axes arrows.void
setAxisMirror(int axis, boolean b)
Sets whether the mirror of an axis will be drawn or not.void
setAxisPenTicWidth(int penWidth)
Sets the pen width to draw tick axes.void
setAxisX()
Sets X-axis (bottom).void
setAxisY()
Sets Y-axis (left).void
setBackgColor(java.awt.Color color)
Sets the actual background color of the entire graph panel.void
setBackgColorForAllGraph(java.awt.Color c)
Sets the background color of all graphs.void
setBackgColorGraph(java.awt.Color c)
Sets the background color of the current graph.void
setBox(boolean b)
Sets whether or not to draw the bounding box around the graph.void
setBoxColor(java.awt.Color c)
Sets the color of the bounding box drawn around a graph.void
setBoxFillColor(java.awt.Color c)
Sets the fill color of the bounding box drawn around a graph.void
setBoxOffset(double f)
Sets the offset of the bounding box drawn around a graph.void
setContour(boolean contour)
Set to a contour stylevoid
setContourBar(boolean bar)
Show or not a bar with color levelsvoid
setContourBins(int binsX, int binsY)
How many bins used to slice the data in X (and Y)void
setContourGray(boolean gray)
Color style to show contour plot.void
setContourLevels(int levels)
How many color levels shuul be shown (10 default)void
setDataPers(jplot.DataArray data)
Sets the data in the form DataArray datavoid
setGraph()
Set the graph from JPLotvoid
setGraphSettings(jplot.GraphSettings ggs)
Set a new graph settings for the current plotvoid
setGrid(boolean b)
Sets whether or not using grid lines.void
setGrid(int axis, boolean b)
Sets whether or not using grid lines.void
setGridAll(int axis, boolean b)
Sets or not the grid lines for all plots on the same canvasvoid
setGridColorAll(java.awt.Color c)
Sets color of the grid lines for all plots on the same canvasvoid
setGridToFront(boolean b)
Setting the flag to true, this will draw the grid after drawing all the lines and point stuff, hence on the foreground.void
setInnerColor(java.awt.Color c)
Sets the color used to fill the inner triangles.void
setLegend(boolean b)
Sets whether or not to draw the legend.void
setLegendFont(java.awt.Font font)
Sets the actual font of the legend.void
setLegendFont(java.lang.String name)
Set the label font, which is used for axis labels and legend labels.void
setLegendPos(double x, double y, java.lang.String system)
Sets the x and y coordinates of the legend.void
setLegendPos(int axis, double coordinate)
Sets the x or y coordinates (defined relative to the data ranges on the axes) of the legend.void
setLegendPosUse(boolean b)
Sets whether or not to set the legend position in X,Y coordinates as defined by the graph.void
setLegendSpac(double dy)
Sets the vertical spacing, between each line of the legend.void
setLogScale(int axis, boolean b)
Sets true or false to plot on a log scale.void
setMarginBottom(double bm)
Sets the distance between the bottom-border of the panel and the bottom X-axis.void
setMarginLeft(double lm)
Sets the distance between the left-border of the panel and the left Y-axis.void
setMarginRight(double rm)
Sets the distance between the right-border of the panel and the right Y-axis.void
setMarginTop(double tm)
Sets the distance between the top-border of the panel and the top X-axis.void
setMaxNumberOfSubticsLog(int n)
Sets the maximum number of subticks allowed for log10 scale.void
setMaxValue(int axis, double max)
Sets the maximum data value displayed on the axis.void
setMinValue(int axis, double min)
Sets the start-value displayed on the axis.void
setName(java.lang.String name)
Sets a title for the current plot.void
setName(java.lang.String s, java.awt.Font f)
Sets a title for the current plot with all attributesvoid
setName(java.lang.String s, java.awt.Font f, java.awt.Color c)
Sets a title for the current plot with all attributesvoid
setNamePos(double x, double y)
Sets the position for the title of the current plot.void
setNamePos(double x, double y, java.lang.String system)
Sets the position for the title of the current plot.void
setNameX(java.lang.String s)
Sets the name for X axis.void
setNameX(java.lang.String s, java.awt.Font f)
Sets the name for X axis.void
setNameX(java.lang.String s, java.awt.Font f, java.awt.Color c)
Set the label for the axis in Xvoid
setNameXpos(double x, double y)
Sets the position for label on X axis in NDC system.void
setNameXpos(double x, double y, java.lang.String system)
Sets the position for label on X axis.void
setNameY(java.lang.String s)
Sets the name for Y axis.void
setNameY(java.lang.String s, java.awt.Font f)
Sets the name for Y axis.void
setNameY(java.lang.String s, java.awt.Font f, java.awt.Color c)
Sets the Title for Y-axisvoid
setNameYpos(double x, double y)
Sets the position for label on Y axis in NDC system.void
setNameYpos(double x, double y, java.lang.String system)
Sets the position for label on Y axis.void
setNumberOfTics(int axis, int n)
Sets the number of ticks for the specified axis.void
setNumberOfTicsFixed(boolean b)
Says whether the user fixes the number of ticks for a specific for all axes.void
setNumberOfTicsFixed(int axis, boolean b)
Says whether the user fixes the number of ticks for a specific axis.void
setPanelSize(java.awt.Dimension d)
Sets the dimensions of the panel of the graph.void
setPenWidthAxis(double width)
Set pen width to draw axisvoid
setPrimitivesToFront(boolean b)
Setting the flag to true, this will draw all primitives after drawing all the lines and point stuff, hence on the foreground.void
setRange(double minX, double maxX, double minY, double maxY)
Sets the range for the current plotvoid
setRange(int axis, double min, double max)
Sets the range (min-max) displayed on the axis.void
setRangeAll(double minX, double maxX, double minY, double maxY)
Sets the range for all plotsvoid
setRangeAll(int axis, double min, double max)
Sets the range (min-max) displayed on all axises.void
setRangeX(double min, double max)
Sets the range (min-max) displayed on X.void
setRangeY(double min, double max)
Sets the range (min-max) displayed on Yvoid
setShadow(boolean b)
Defines whether or not a shadow will be drawn at the panel border.void
setSubTicLength(double length)
Sets the length of the subticks for all axises.void
setSubTicLength(int axis, double length)
Sets the length of the subticks.void
setSubTicNumber(int axis, int number)
Sets the number of subticks between ticks.void
setTicColor(java.awt.Color color)
Sets the color used by the labels drawn at each tick (for all axises).void
setTicColor(int axis, java.awt.Color color)
Sets the color used by the labels drawn at each tick.void
setTicFont(java.awt.Font font)
Sets the font used by the labels drawn at each tick (for all axises).void
setTicFont(int axis, java.awt.Font font)
Sets the font used by the labels drawn at each tick.void
setTicLabels(boolean b)
Sets whether all tick-labels will be written or not.void
setTicLabels(int axis, boolean b)
Sets whether tick-labels will be shown or not.void
setTicLength(double length)
Sets the length of the ticks for all axes.void
setTicLength(int axis, double length)
Sets the length of the ticks.void
setTics(boolean b)
Sets whether or not to draw ticks (little lines on the axes) for all axis.void
setTics(int axis, boolean b)
Sets whether or not to draw ticks (little lines on the axes).void
setTicsMirror(boolean b)
Sets true or false to draw mirror ticks for X and Yvoid
setTicsMirror(int axis, boolean b)
Sets true or false to draw mirror ticksvoid
setTicsRotate(int axis, boolean b)
Defines whether we should rotate ticks.void
showAllGraph(boolean vs)
Set the all graphs visible or notvoid
showGraph(boolean vs)
Set the current graph visible or notint
sizeData()
The data size, i.e.int
toX(double x)
Convert the user coordinate X to the pixel coordinateint
toY(double y)
Convert the user coordinate Y to the pixel coordinateITree
treeF()
Return TreeFactory associated with the plotvoid
update()
Just update the current plot selected using cd() methodvoid
update(int n1, int n2)
Refresh only a particular pad.void
updateAll()
Refresh all the plots on the same canvas HPLOTvoid
updateGraphIfShowing()
Update the graph if it is showing.boolean
useNumberOfTics(int axis)
Returns whether or not to use a fixed number of ticks.void
viewHisto(boolean what)
If true, then this suppresses all negative values in Y, i.e.void
visible()
Set the canvas frame visiblevoid
visible(boolean vs)
Set the canvas frame visible or notvoid
visible(int posX, int posY)
Set the canvas frame visible.void
write(java.lang.String file)
Write HPlot file and inserts graphs to the main frame.-
Methods inherited from class jhplot.gui.GHFrame
addGraph, cd, componentHidden, componentMoved, componentShown, getCdX, getCdY, getFrame, getHTMLUrl, getNtotX, getNtotY, setPlotsNum, updateFrame
-
Methods inherited from class jhplot.gui.GHPanel
addComp, componentResized, convertSVG, convertSVG, disableDoubleBuffering, enableDoubleBuffering, export, getCanvasPanel, getMarginBackground, getMarginPanelBottom, getMarginPanelCenter, getMarginPanelLeft, getMarginPanelRight, getMarginPanelTop, getMarginSizeBottom, getMarginSizeLeft, getMarginSizeRight, getMarginSizeTop, getSizeX, getSizeY, getTextBottom, getTextBottomColor, getTextBottomColorBack, getTextBottomFont, getTextLeft, getTextLeftColor, getTextLeftColorBack, getTextLeftFont, getTextPosBottomX, getTextPosBottomY, getTextPosLeftX, getTextPosLeftY, getTextPosRightX, getTextPosRightY, getTextPosTopX, getTextPosTopY, getTextRight, getTextRightColor, getTextRightColorBack, getTextRightFont, getTextRotationBottom, getTextRotationLeft, getTextRotationRight, getTextRotationTop, getTextTop, getTextTopColor, getTextTopColorBack, getTextTopFont, isBorderShown, printGraph, resetMargins, setGTitle, setGTitle, setGTitle, setGTitle, setGTitle, setMarginBackground, setMarginSizeBottom, setMarginSizeLeft, setMarginSizeRight, setMarginSizeTop, setSizePanel, setTextBottom, setTextBottom, setTextBottom, setTextBottom, setTextBottomColorBack, setTextLeft, setTextLeft, setTextLeft, setTextLeft, setTextLeftColorBack, setTextPosBottomX, setTextPosBottomY, setTextPosLeftX, setTextPosLeftY, setTextPosRightX, setTextPosRightY, setTextPosTopX, setTextPosTopY, setTextRight, setTextRight, setTextRight, setTextRight, setTextRightColorBack, setTextRotationBottom, setTextRotationLeft, setTextRotationRight, setTextRotationTop, setTextTop, setTextTop, setTextTop, setTextTopColorBack, showBorders
-
-
-
-
Constructor Detail
-
HPlot
public HPlot(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean set)
Create HPlot canvas with several plots.- Parameters:
title
- Titlexsize
- size in x directionysize
- size in y directionn1
- number of plots/graphs in xn2
- number of plots/graphs in yset
- set or not the graph
-
HPlot
public HPlot(java.lang.String title, int xsize, int ysize, int n1, int n2)
Create HPlot canvas with several plots.- Parameters:
title
- Titlexsize
- size in x directionysize
- size in y directionn1
- number of plots/graphs in xn2
- number of plots/graphs in y
-
HPlot
public HPlot(java.lang.String title, int xs, int ys)
Construct a HPlot canvas with a single plot.- Parameters:
title
- Title for the canvasxs
- size in xys
- size in y
-
HPlot
public HPlot(java.lang.String title, int xs, int ys, boolean set)
Construct a HPlot canvas with a single plot.- Parameters:
title
- Title for the canvasxs
- size in xys
- size in yset
- set or not the graph (boolean)
-
HPlot
public HPlot(java.lang.String title)
Construct a HPlot canvas with a plot with the size 600x400.- Parameters:
title
- Title
-
HPlot
public HPlot()
Construct a HPlot canvas with a single plot with the size 600x400.
-
-
Method Detail
-
refreshFrame
public void refreshFrame()
Refresh all the frames
-
read
public void read(java.lang.String file)
Read HPlot file and inserts graphs to the main frame.- Parameters:
file
- input file
-
write
public void write(java.lang.String file)
Write HPlot file and inserts graphs to the main frame.- Parameters:
file
- ouput file
-
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
-
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
-
distroy
public void distroy()
Remove the canvas frame
-
showGraph
public void showGraph(boolean vs)
Set the current graph visible or not- Parameters:
vs
- (boolean) true: visible, false: not visible
-
showAllGraph
public void showAllGraph(boolean vs)
Set the all graphs visible or not- Parameters:
vs
- (boolean) true: visible, false: not visible
-
factories
public void factories()
Create various JAIDA factories: IAnalysisFactory, ITree, IFitFactory, IFunctionFactory
-
analF
public IAnalysisFactory analF()
Return IAnalysisFactory associated with the plot- Returns:
- IAnalysisFactory
-
treeF
public ITree treeF()
Return TreeFactory associated with the plot- Returns:
- ITree
-
fitF
public IFitFactory fitF()
Return FitFactory associated with the plot- Returns:
- IFitFactory
-
funcF
public IFunctionFactory funcF()
Return FunctionFactory associated with the plot- Returns:
- IFunctionFactory
-
histF
public IHistogramFactory histF()
Return IHistogramFactory associated with the plot- Returns:
- IHistogramFactory
-
setGraph
public void setGraph()
Set the graph from JPLot
-
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 padheightScale
- 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 xn2
- the location of the plot in ywidthScale
- scale factor applied to the width of the current padheightScale
- scale factor applied the height of the current pad.
-
updateAll
public void updateAll()
Refresh all the plots on the same canvas HPLOT
-
update
public void update(int n1, int n2)
Refresh only a particular pad.- Parameters:
n1
- the location of the plot in xn2
- the location of the plot in y
-
update
public void update()
Just update the current plot selected using cd() method
-
updateGraphIfShowing
public void updateGraphIfShowing()
Update the graph if it is showing. It applies for the current graph only
-
viewHisto
public void viewHisto(boolean what)
If true, then this suppresses all negative values in Y, i.e. the plot starts with 0 in Y. This is useful if you want to show histograms- Parameters:
what
- if true, sets a histogram view
-
printGraphSettings
public void printGraphSettings()
Print the current graph settings to System.out
-
setAttResizable
public void setAttResizable(boolean resizable)
Set canvas attributes resizable (line widths, symbols, fonts) or not. Applicable for the current pad only (navigated as cd(N1,N2)). The defaul is resizable when you resize the canvas.- Parameters:
resizable
- set true if it should be resizable.
-
setAttResizableAll
public void setAttResizableAll(boolean resizable)
Set canvas attributes resizable (line widths, symbols, fonts) or not. Applicable for all pads only. The defaul is resizable when you resize the canvas.- Parameters:
resizable
- set true if it should be resizable.
-
printGraphSettings
public void printGraphSettings(java.io.PrintStream out)
Print the current graph settings to System.out- Parameters:
out
- input print stream
-
setContour
public void setContour(boolean contour)
Set to a contour style- Parameters:
contour
- set to true for a contour style
-
setContourBar
public void setContourBar(boolean bar)
Show or not a bar with color levels- Parameters:
bar
- true if the bar is shown
-
setContourLevels
public void setContourLevels(int levels)
How many color levels shuul 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 XbinsY
- 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
-
setAntiAlias
public void setAntiAlias(boolean setit)
Set antialiasing for the graphics of the current plot- Parameters:
setit
- true if antialiasing is set
-
getAntiAlias
public boolean getAntiAlias()
Get antialiasing for the graphics of the current plot- Returns:
- true if antialiasing is set
-
setAntiAliasAll
public void setAntiAliasAll(boolean setit)
Set antialiasing for the graphics of all plots- Parameters:
setit
- true if antialiasing is set
-
setNameX
public void setNameX(java.lang.String s, java.awt.Font f, java.awt.Color c)
Set the label for the axis in X- Parameters:
s
- label titlef
- Fontc
- Color
-
setLegendFont
public void setLegendFont(java.awt.Font font)
Sets the actual font of the legend.- Parameters:
font
- new font to draw the legend.- See Also:
getLegendFont()
-
setLegendFont
public void setLegendFont(java.lang.String name)
Set the label font, which is used for axis labels and legend labels. The font names understood are those understood by java.awt.Font.decode().- Parameters:
name
- A font name.
-
setMarginLeft
public void setMarginLeft(double lm)
Sets the distance between the left-border of the panel and the left Y-axis.- Parameters:
lm
- the left margin in points.- See Also:
getMarginLeft()
-
getMarginLeft
public double getMarginLeft()
Returns the distance between the left-border of the panel and the left Y-axis.- Returns:
- the left margin.
-
getPanelSize
public java.awt.Dimension getPanelSize()
Returns the dimensions of the panel used to display the graph.- Returns:
- the panel dimension of the graph
-
setPanelSize
public void setPanelSize(java.awt.Dimension d)
Sets the dimensions of the panel of the graph.- Parameters:
d
- Size of the graph panel
-
getMarginRight
public double getMarginRight()
Returns the distance between the right-border of the panel and the right Y-axis.- Returns:
- the right margin.
-
setMarginRight
public void setMarginRight(double rm)
Sets the distance between the right-border of the panel and the right Y-axis.- Parameters:
rm
- the right margin in points.
-
getPenWidthAxis
public double getPenWidthAxis()
Get pen width to draw axis- Returns:
- the right margin.
-
setPenWidthAxis
public void setPenWidthAxis(double width)
Set pen width to draw axis
-
getMarginBottom
public double getMarginBottom()
Returns the distance between the bottom-border of the panel and the bottom X-axis.- Returns:
- the bottom margin.
-
setMarginBottom
public void setMarginBottom(double bm)
Sets the distance between the bottom-border of the panel and the bottom X-axis.- Parameters:
bm
- the bottom margin in points.
-
getMarginTop
public double getMarginTop()
Returns the distance between the top-border of the panel and the top X-axis.- Returns:
- the top margin.
-
setMarginTop
public void setMarginTop(double tm)
Sets the distance between the top-border of the panel and the top X-axis.- Parameters:
tm
- the top margin in points.
-
getTicLength
public double getTicLength(int axis)
Returns the length of the ticks.
-
getSubTicLength
public double getSubTicLength(int axis)
Returns the length of the sub-ticks.
-
getSubTicNumber
public void getSubTicNumber(int axis)
Get the number of subticks for a given axis- Parameters:
axis
- Axis value (0 or 1)
-
setTicLength
public void setTicLength(int axis, double length)
Sets the length of the ticks. In fact, the actual tick length is the value you set here multiplied by the axis length. By default, the tick-length is exactly 0.012 times the axis length. Using a value proportional to the axes system leads to reasonable proportions even if the graph is blown up to full screen (which users often do, trust me).
-
setSubTicLength
public void setSubTicLength(int axis, double length)
Sets the length of the subticks. In fact, the actual subtic length is the value you set here multiplied by the axis length. By default, the tic-length is exactly 0.007 times the axis length. Using a value proportional to the axes system leads to reasonable proportions even if the graph is blown up to full screen (which users often do, trust me).
-
setSubTicNumber
public void setSubTicNumber(int axis, int number)
Sets the number of subticks between ticks. For log scale, the default is 10. If you do not want subtics, set it to 0.- Parameters:
axis
- Axis (0 for X, 1 for Y)number
- Number of subticks between ticks
-
setTicLength
public void setTicLength(double length)
Sets the length of the ticks for all axes.- Parameters:
length
- tick length relative to the axis length
-
setSubTicLength
public void setSubTicLength(double length)
Sets the length of the subticks for all axises.- Parameters:
length
- subtick length relative to the axis length
-
getAxesRatioUse
public boolean getAxesRatioUse()
Says whether we should use a fixed ratio between X- and Y-axes lengths.- Returns:
- true if the ratio should be fixed, false otherwise.
-
setAxesRatioUse
public void setAxesRatioUse(boolean b)
Sets whether or not to use a fixed ratio between X- and Y-axes lengths. By default, this ratio is defined by (read: proportional to) the panel dimensions.- Parameters:
b
- true if the ratio is fixed and independent of the panel size.
-
getAxesRatio
public double getAxesRatio()
Returns the current ratio between X- and Y-axes lengths.- Returns:
- the ratio Y-axisLength/X-axisLength
-
setAxesRatio
public void setAxesRatio(double r)
Sets the ratio between X- and Y-axes lengths. This ratio must be greater than 0.0, a value of 0.0 means that the ratio will be calculated automatically as a function of the size of the graph panel.- Parameters:
r
- the ratio Y-axisLength/X-axisLength
-
setAxisArrow
public void setAxisArrow(int type)
Sets axes arrows. Arrows are not drawn on mirror axes. Arrows are only drawn if one first remove all axes (removeAxes() method) and then use setAxis() or setAxisY() methods to draw X or Y axis shown by arrows.- Parameters:
type
- 0: no arrows, just lines
1: not filled arrows
2: nice filled arrows
-
getAxisArrow
public int getAxisArrow()
Gets axis arrows.- Returns:
- type 0: no arrows, just lines
1: not filled arrows
2: nice filled arrows
-
setNumberOfTicsFixed
public void setNumberOfTicsFixed(int axis, boolean b)
Says whether the user fixes the number of ticks for a specific axis. If not fixed, JHPlot will try to calculate a convenient number of ticks.
-
setNumberOfTicsFixed
public void setNumberOfTicsFixed(boolean b)
Says whether the user fixes the number of ticks for a specific for all axes.- Parameters:
b
- true if you want to fix the number of ticks.
-
useNumberOfTics
public boolean useNumberOfTics(int axis)
Returns whether or not to use a fixed number of ticks.
-
getNumberOfTics
public int getNumberOfTics(int axis)
Returns the number of ticks for the specified axis.
-
setNumberOfTics
public void setNumberOfTics(int axis, int n)
Sets the number of ticks for the specified axis. If not fixed, JHPlot will try to calculate a convenient number of ticks.- Parameters:
axis
- Defines to which axis this function applies. Use 0 for X and 1 for Y.n
- Number of ticks
-
getMaxNumberOfSubticsLog
public int getMaxNumberOfSubticsLog()
Returns the maximum number of subticks for log scale (default is 10). This number applies to all axes, and 10 ticks is right number for you- Returns:
- Maximum number of subticks allowed for log scale
-
setMaxNumberOfSubticsLog
public void setMaxNumberOfSubticsLog(int n)
Sets the maximum number of subticks allowed for log10 scale. This number is set to 10.- Parameters:
n
- Maximum allowed number of subticks in log10 scale
-
getMinValue
public double getMinValue(int axis)
Returns the minimum data value for the specified axis.
-
setMinValue
public void setMinValue(int axis, double min)
Sets the start-value displayed on the axis.
-
getMaxValue
public double getMaxValue(int axis)
Returns the maximum data value for the specified axis.
-
setMaxValue
public void setMaxValue(int axis, double max)
Sets the maximum data value displayed on the axis.
-
getLegendFont
public java.awt.Font getLegendFont()
Returns the font used by the legend.- Returns:
- Actual font used by the legend.
-
setLegend
public void setLegend(boolean b)
Sets whether or not to draw the legend.- Parameters:
b
- true if you want to show the legend.
-
setLegendPos
public void setLegendPos(int axis, double coordinate)
Sets the x or y coordinates (defined relative to the data ranges on the axes) of the legend.
-
setLegendPos
public void setLegendPos(double x, double y, java.lang.String system)
Sets the x and y coordinates of the legend.- Parameters:
x
- the x coordinate of the legend.y
- the y coordinate of the legend.system
- coordinate system (USER or NDC)
-
getLegendPosUse
public boolean getLegendPosUse()
Returns whether or not we use the legend coordinates. If not using the coordinates, we let JHPlot define the legend position.- Returns:
- true if you want to set the legend coordinates
-
setLegendPosUse
public void setLegendPosUse(boolean b)
Sets whether or not to set the legend position in X,Y coordinates as defined by the graph. If not using the coordinates, we let JHPlot define the legend position.- Parameters:
b
- true if you want to set the position
-
getLegendSpacing
public double getLegendSpacing()
Returns the vertical spacing, between each line of the legend.- Returns:
- vertical spacing for the legend.
-
setLegendSpac
public void setLegendSpac(double dy)
Sets the vertical spacing, between each line of the legend. The spacing is relative to the font-size of the legend. This means that the value 1 (default) is a normal spacing, and e.g. 2 is as if you left a blank line between two legend labels.- Parameters:
dy
- vertical spacing for the legend.
-
getLegendPos
public double getLegendPos(int axis)
Returns the x or y coordinates (defined in pixels, relative to the size of the panel showing the graph) of the legend.
-
setLogScale
public void setLogScale(int axis, boolean b)
Sets true or false to plot on a log scale.
-
setTicsMirror
public void setTicsMirror(int axis, boolean b)
Sets true or false to draw mirror ticks
-
setTicsMirror
public void setTicsMirror(boolean b)
Sets true or false to draw mirror ticks for X and Y- Parameters:
b
- toggle, true if the we should draw mirror ticks
-
getTicsMirror
public boolean getTicsMirror(int axis)
Returns whether or not we should draw ticks on the mirror axis.
-
setTicsRotate
public void setTicsRotate(int axis, boolean b)
Defines whether we should rotate ticks. By default the are pointing to the inside of the graph: setting it to false will draw them towards the outside.
-
getTicsRotate
public boolean getTicsRotate(int axis)
Returns whether or not we should rotate the ticks. Rotated ticks are drawn at the outer-side of the axes.
-
setShadow
public void setShadow(boolean b)
Defines whether or not a shadow will be drawn at the panel border.- Parameters:
b
- toggle, true if the shadow should be drawn.
-
getShadow
public boolean getShadow()
Returns whether or not a shadow will be drawn at the panel border. Only nice if applied to a graph panel which is wrapped inside another panel, hence enabled in JHPlot.- Returns:
- true if the shadow should be drawn.
-
setGrid
public void setGrid(int axis, boolean b)
Sets whether or not using grid lines. Grid lines are lines drawn from tick to tick. They can be enabled/disabled per axis.
-
setGrid
public void setGrid(boolean b)
Sets whether or not using grid lines. Grid lines are lines drawn from tick to tick. They can be enabled/disabled per axis.- Parameters:
b
- true if shown
-
setGridAll
public void setGridAll(int axis, boolean b)
Sets or not the grid lines for all plots on the same canvas- Parameters:
axis
- Axis (0 means X, 1 means Y)b
- true is grid is shown
-
setGridColorAll
public void setGridColorAll(java.awt.Color c)
Sets color of the grid lines for all plots on the same canvas- Parameters:
c
- Color
-
getGridColor
public java.awt.Color getGridColor()
Sets the color of the overall grid. The same color applies to horizontal and vertical lines.- Returns:
- Grid color
-
getInnerColor
public java.awt.Color getInnerColor()
Returns the color used to fill the shaded triangles.- Returns:
- Color used to fill the shaded triangles.
-
setInnerColor
public void setInnerColor(java.awt.Color c)
Sets the color used to fill the inner triangles. This is for the very special piper-diagram graph, one of the fancy possibilities of JHPlot ;-)- Parameters:
c
- the color used to fill the shaded triangles.
-
setGridToFront
public void setGridToFront(boolean b)
Setting the flag to true, this will draw the grid after drawing all the lines and point stuff, hence on the foreground.- Parameters:
b
- true if the grid will be moved to the front
-
isGridToFront
public boolean isGridToFront()
Flag, saying whether the grid should be drawn at the foreground or not.- Returns:
- whether or not to draw the grid at the front.
- See Also:
setGridToFront(boolean)
-
setPrimitivesToFront
public void setPrimitivesToFront(boolean b)
Setting the flag to true, this will draw all primitives after drawing all the lines and point stuff, hence on the foreground.- Parameters:
b
- true if primitives will be moved to the front
-
isPrimitivesToFront
public boolean isPrimitivesToFront()
Flag, saying whether primitives should be drawn at the foreground or not.- Returns:
- whether or not to draw the primitives at the front.
-
setBox
public void setBox(boolean b)
Sets whether or not to draw the bounding box around the graph. Note: this box can be filled with any color.- Parameters:
b
- true if the filled triangles should be drawn.
-
setBoxOffset
public void setBoxOffset(double f)
Sets the offset of the bounding box drawn around a graph.- Parameters:
f
- offset in pixels.
-
getBoxOffset
public float getBoxOffset()
Returns the offset of the bounding box.- Returns:
- the offset of the bounding box.
-
setBoxFillColor
public void setBoxFillColor(java.awt.Color c)
Sets the fill color of the bounding box drawn around a graph.- Parameters:
c
- Color for the fill
-
getBoxFillColor
public java.awt.Color getBoxFillColor()
Returns the fill-color of the eventual bounding box arround the graph- Returns:
- the fill color of the bounding box.
-
getBoxColor
public java.awt.Color getBoxColor()
Returns the color used to draw the bounding box.- Returns:
- the color of the bounding box.
-
setBoxColor
public void setBoxColor(java.awt.Color c)
Sets the color of the bounding box drawn around a graph.- Parameters:
c
- drawing color.
-
getBackgColor
public java.awt.Color getBackgColor()
Returns the actual background color of the entire graph panel.- Returns:
- background color of the graph.
-
setBackgColor
public void setBackgColor(java.awt.Color color)
Sets the actual background color of the entire graph panel. Note that it is possible to set the color of the area within the axes system separately.- Parameters:
color
- New background color.
-
setBackgColorGraph
public void setBackgColorGraph(java.awt.Color c)
Sets the background color of the current graph. This is the area between the axes (hence not the entire panel area).- Parameters:
c
- color.
-
setBackgColorForAllGraph
public void setBackgColorForAllGraph(java.awt.Color c)
Sets the background color of all graphs. This is the area between the axes (hence not the entire panel area).- Parameters:
c
- color.
-
getBackgColorGraph
public java.awt.Color getBackgColorGraph()
Returns the background color of the current graph. This is the area between the axes (hence not the entire panel area).- Returns:
- the background color of the graph.
-
getGraphSettings
public jplot.GraphSettings getGraphSettings(int n1, int n2)
Get graph settings- Parameters:
n1
- position of graph in xn2
- position of graph in y- Returns:
- GraphSettings
-
setGraphSettings
public void setGraphSettings(jplot.GraphSettings ggs)
Set a new graph settings for the current plot- Parameters:
ggs
- new graph settings
-
getGraphSettings
public jplot.GraphSettings getGraphSettings()
Get graph settings for current plot- Returns:
- GraphSettings
-
getJPlot
public jplot.JPlot getJPlot(int n1, int n2)
Get jplots for each graph- Parameters:
n1
- position of graph in xn2
- position of graph in y- Returns:
- JPlot
-
getJPlot
public jplot.JPlot getJPlot()
Get jplots for each graph for current graph- Returns:
- JPlot
-
setNameX
public void setNameX(java.lang.String s)
Sets the name for X axis. The color is black, the font is ("Arial", Font.BOLD, 14)- Parameters:
s
- Title for X axis.
-
setNameX
public void setNameX(java.lang.String s, java.awt.Font f)
Sets the name for X axis. The color is black, the font is ("Arial", Font.BOLD, 14)- Parameters:
s
- Title for X axis.f
- Font
-
setNameXpos
public void setNameXpos(double x, double y, java.lang.String system)
Sets the position for label on X axis. Specify "USER" or "NDC" Deafalt is NDC- Parameters:
x
- X positiony
- Y positionsystem
- coordinate system (USER or NDC)
-
setNameYpos
public void setNameYpos(double x, double y, java.lang.String system)
Sets the position for label on Y axis. Specify "USER" or "NDC" Deafalt is NDC- Parameters:
x
- X positiony
- Y positionsystem
- coordinate system (USER or NDC)
-
setNameXpos
public void setNameXpos(double x, double y)
Sets the position for label on X axis in NDC system.- Parameters:
x
- X positiony
- Y position
-
setNameYpos
public void setNameYpos(double x, double y)
Sets the position for label on Y axis in NDC system.- Parameters:
x
- X positiony
- Y position
-
setNameY
public void setNameY(java.lang.String s)
Sets the name for Y axis. The color is black, the font is ("Arial", Font.BOLD, 14)- Parameters:
s
- Title for Y axis.
-
setNameY
public void setNameY(java.lang.String s, java.awt.Font f)
Sets the name for Y axis. The color is black, the font is ("Arial", Font.BOLD, 14)- Parameters:
s
- Title for Y axis.f
- Font
-
setNameY
public void setNameY(java.lang.String s, java.awt.Font f, java.awt.Color c)
Sets the Title for Y-axis- Parameters:
s
- Label namef
- Fontc
- Color
-
setName
public void setName(java.lang.String name)
Sets a title for the current plot. The default color is black, the font is ("Arial", Font.BOLD, 18),- Parameters:
name
- Title
-
setName
public void setName(java.lang.String s, java.awt.Font f, java.awt.Color c)
Sets a title for the current plot with all attributes- Parameters:
s
- Titlef
- Fontc
- Color
-
setName
public void setName(java.lang.String s, java.awt.Font f)
Sets a title for the current plot with all attributes- Parameters:
s
- Titlef
- Font
-
setNamePos
public void setNamePos(double x, double y, java.lang.String system)
Sets the position for the title of the current plot. Specify "USER" or "NDC" Default is NDC- Parameters:
x
- X positiony
- Y positionsystem
- coordinate system (USER or NDC)
-
setNamePos
public void setNamePos(double x, double y)
Sets the position for the title of the current plot. Specify "USER" or "NDC" Default is NDC- Parameters:
x
- X positiony
- Y position
-
removeLabels
public void removeLabels()
remove HLabels and HMLabels on the current plot
-
removeAxes
public void removeAxes()
Remove X and Y axes, ticks, axis labels on the current plot.
-
removeLabel
public void removeLabel(int i)
remove i-th HLabel or HMLabel on the current plot- Parameters:
i
- index of the label to br removed
-
numberLabels
public int numberLabels()
No labels on the current plot.
-
removeLabelsAll
public void removeLabelsAll()
remove all Labels on all plots.
-
removePrimitives
public void removePrimitives()
remove 2D java primitives on the current plot
-
removePrimitives
public void removePrimitives(int i)
remove i-th 2D java primitives on the current plot- Parameters:
i
- index of the primitive to be removed
-
numberPrimitives
public int numberPrimitives()
No of primitives for the current plot.
-
removePrimitivesAll
public void removePrimitivesAll()
remove all 2D java primitives
-
axisLengthX
public double axisLengthX()
Length of X axis in pixels.- Returns:
- Length of X axis
-
axisLengthY
public double axisLengthY()
Length of Y axis in pixels.- Returns:
- Length of Y axis
-
toX
public int toX(double x)
Convert the user coordinate X to the pixel coordinate- Parameters:
x
- user coordiinate X for conversion
-
toY
public int toY(double y)
Convert the user coordinate Y to the pixel coordinate- Parameters:
y
- user coordiinate Y for conversion
-
add
public void add(HLabel label)
Add a label to the Canvas. Note: Call update() method to draw it The label can be added in NDC or USER (axis-dependent) coordinates.- Parameters:
label
- Label to be added
-
add
public void add(HKey label)
Add a key to the Canvas. Note: Call update() method to draw it Normally, unlike Legend, it is not associated to any data set.- Parameters:
label
- key to be added
-
add
public void add(HMLabel label)
Add a multiline label to the Canvas. Note: Call update() method to draw it- Parameters:
label
- Label to be added
-
draw
public void draw(HLabel label)
Draw a label. Note: it is smilar to add(HLabel), only update() is called automatically- Parameters:
label
- Label to be drawn
-
draw
public void draw(HKey label)
Draw a key. Note: it is smilar to add(HKey), only update() is called automatically.- Parameters:
label
- a key to be drawn
-
add
public void add(HLabelEq ob)
Add a LaTeX equation to the canvas.
-
draw
public void draw(HLabelEq ob)
Draw a LaTeX rquation on the Canvas. It is similar to add(HShape), only update() method is called authomatically
-
add
public void add(HShape ob)
Add a shape primitive to the Canvas. Note: Primitives will be shown after the update() method
-
draw
public void draw(HShape ob)
Draw a shape primitive to the Canvas. It is similar to add(HShape), only update() method is called authomatically
-
draw
public void draw(HMLabel ob)
Draw a multiline label. The update() method is called authomatically
-
getAxesColor
public java.awt.Color getAxesColor()
Returns the actual color of the axes of the graph.- Returns:
- actual color used to draw the axes.
-
setAxesColor
public void setAxesColor(java.awt.Color color)
Sets the actual color of the axes of the graph.- Parameters:
color
- new color to draw the axes.
-
getTicFont
public java.awt.Font getTicFont(int axis)
Returns the font used by the labels drawn at each tick.
-
setTicFont
public void setTicFont(int axis, java.awt.Font font)
Sets the font used by the labels drawn at each tick.
-
setTicFont
public void setTicFont(java.awt.Font font)
Sets the font used by the labels drawn at each tick (for all axises).- Parameters:
font
- the new font
-
getTicColor
public java.awt.Color getTicColor(int axis)
Returns the color used by the labels drawn at each tick.
-
setTicColor
public void setTicColor(int axis, java.awt.Color color)
Sets the color used by the labels drawn at each tick.
-
setTicColor
public void setTicColor(java.awt.Color color)
Sets the color used by the labels drawn at each tick (for all axises).- Parameters:
color
- the new color for each axis.
-
isAxisShown
public boolean isAxisShown(int axis)
Returns whether an axis line will be drawn or not.
-
setAxis
public void setAxis(int axis, boolean b)
Sets whether an axis line will be drawn or not. This does not affect ticks and labels.
-
setAxisX
public void setAxisX()
Sets X-axis (bottom). First remove all axes using removeAxes() method. Do not draw miror axis, but all tcs and labels will be drawn.
-
setAxisY
public void setAxisY()
Sets Y-axis (left). First remove all axes using removeAxes() method. Do not draw miror axis, but all tcs and labels will be drawn.
-
setAxisAll
public void setAxisAll(boolean b)
Sets whether all axis lines will be drawn or not.- Parameters:
b
- toggle, true if the axis should be drawn.
-
setAxisPenTicWidth
public void setAxisPenTicWidth(int penWidth)
Sets the pen width to draw tick axes.- Parameters:
penWidth
- pen width to draw the tick axes lines
-
getAxisPenTicWidth
public int getAxisPenTicWidth()
Get the pen width to draw tick axes- Returns:
- pen width to draw the tick axes lines
-
isMirrorAxisShown
public boolean isMirrorAxisShown(int axis)
Returns whether the mirror of an axis will be drawn or not.
-
setAxisMirror
public void setAxisMirror(int axis, boolean b)
Sets whether the mirror of an axis will be drawn or not.
-
isTicLabelsShown
public boolean isTicLabelsShown(int axis)
Returns whether or not to draw the tick labels
-
setTicLabels
public void setTicLabels(boolean b)
Sets whether all tick-labels will be written or not.- Parameters:
b
- toggle, true if the axis should be drawn.
-
setTicLabels
public void setTicLabels(int axis, boolean b)
Sets whether tick-labels will be shown or not.
-
isTicsShown
public boolean isTicsShown(int axis)
Returns whether or not to draw ticks (little lines on the axes).
-
resetStyle
public void resetStyle()
Resets the current plot settings to default values.
-
resetStyleAll
public void resetStyleAll()
Resets all plot settings to default values.
-
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 characterised by an index in X and Y. This method cleans the data and all graph settings.- Parameters:
i1
- location of the graph in Xi2
- location of the graph in Y
-
clearData
public void clearData()
Clear the current graph from the input data. Graph settings do not change. If graph is showing, it will be updated. Note: the current graph is given by the cd() method. All labels stay the same.
-
clearLabels
public void clearLabels()
Clear graph labels for the curent graph. This is likely a good practice to improve performance. Can be called after clearData().
-
clearLabels
public void clearLabels(int i1, int i2)
Clear Graph settings including labels. This is likely a good practice to improve performance. Can be called after clearData().- Parameters:
i1
- location of the graph in Xi2
- location of the graph in Y
-
clearData
public void clearData(int i1, int i2)
Clear data of the graph characterised by an index in X and Y. Graph settings do not change. If the graph is showed, data will be removed but all setting (labels) stay the same- Parameters:
i1
- location of the graph in Xi2
- location of the graph in Y
-
clearAllData
public void clearAllData()
Clear all graphs from the input data.
-
clearAllLabels
public void clearAllLabels()
Clear all graph labels
-
clearAll
public void clearAll()
Clear all graphs from data and settings.
-
setTics
public void setTics(int axis, boolean b)
Sets whether or not to draw ticks (little lines on the axes).
-
setTics
public void setTics(boolean b)
Sets whether or not to draw ticks (little lines on the axes) for all axis.- Parameters:
b
- toggle, true if the ticks should be drawn.
-
setRange
public void setRange(int axis, double min, double max)
Sets the range (min-max) displayed on the axis.
-
setRangeX
public void setRangeX(double min, double max)
Sets the range (min-max) displayed on X. Y is set to autorange.- Parameters:
min
- minimum value on the axismax
- 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 axismax
- maximum value on the axis
-
setRangeAll
public void setRangeAll(int axis, double min, double max)
Sets the range (min-max) displayed on all axises.
-
setRange
public void setRange(double minX, double maxX, double minY, double maxY)
Sets the range for the current plot- Parameters:
minX
- Min value in XmaxX
- Max value in XminY
- Min value in YmaxY
- Max value in Y
-
setRangeAll
public void setRangeAll(double minX, double maxX, double minY, double maxY)
Sets the range for all plots- Parameters:
minX
- Min value in XmaxX
- Max value in XminY
- Min value in YmaxY
- Max value in Y
-
setAutoRange
public void setAutoRange(int axis, boolean b)
Sets true or false to use automatic scaling for the current plot.
-
setAutoRangeAll
public void setAutoRangeAll(int axis, boolean b)
Sets true or false to use automatic scaling for all plots.
-
setAutoRange
public void setAutoRange(boolean b)
Set autorange in X and Y at the same time- Parameters:
b
- if true, sets autorange
-
setAutoRangeAll
public void setAutoRangeAll(boolean b)
Set auto-range in X and Y at the same time for all plots- Parameters:
b
- if true, sets auto-range
-
setAutoRange
public void setAutoRange()
Set autorange in X and Y at the same time for the current plot
-
setAutoRangeAll
public void setAutoRangeAll()
Set autorange in X and Y at the same time for all plots
-
drawStatBox
public void drawStatBox(H1D h1)
Draw a statistical box (mean, RMS, number of entries)- Parameters:
h1
- histogram H1D
-
drawStatBox
public void drawStatBox(H1D h1, int x, int y)
Draw a statistical box (mean, RMS, number of entries) at a specific position. Use the standard AWT coordinates.- Parameters:
h1
- histogram H1Dx
- position in Xy
- position in Y
-
drawStatBox
public void drawStatBox(H1D h1, double x, double y, java.lang.String howToSet)
Draw a statistical box (mean, RMS, number of entries) at a specific position. Use the "USR" or "NDC" coordinates.- Parameters:
h1
- histogram H1Dx
- position in Xy
- position in YhowToSet
- use "NDC" or "USER" (coordinate dependent)
-
drawTextBox
public void drawTextBox(java.lang.String[] lines)
Draw a text box with some information- Parameters:
lines
- linex of the text to be draws
-
clearData
public void clearData(int i)
Remove one data set from the current plot.- Parameters:
i
- the data set to be removed
-
sizeData
public int sizeData()
The data size, i.e. the number of objects plotted. on the current plot.- Returns:
- data size
-
setDataPers
public void setDataPers(jplot.DataArray data)
Sets the data in the form DataArray data- Parameters:
data
- data container of type DataArray
-
draw
public void draw(H1D[] h1)
Draw array of histograms- Parameters:
h1
- array of H1D histograms
-
draw
public void draw(Cloud1D c1d)
Plot cloud in 1D. Assume 100 bins.- Parameters:
c1d
- Input Cloud1D
-
draw
public void draw(DataPointSet ds)
Plot Aida datapointset.- Parameters:
ds
- Input dataPoint set
-
draw
public void draw(Cloud2D c2d)
Plot cloud 2D- Parameters:
c2D
- Input 2D cloud
-
draw
public void draw(Histogram1D h1d)
Draw 1D histogram- Parameters:
h1d
- input istogram1D
-
draw
public void draw(H1D h1)
Plot 1D histogram.- Parameters:
h1
- Input H1D histogram
-
fit
public int fit(H1D h1, java.lang.String predefFunc, java.lang.String method)
Fit 1D histogram with the function F1D- Parameters:
h1
- H1D histogrampredefFunc
- String predefined functionmethod
- String - method for the fit- Returns:
- int Fit results
-
draw
public void draw(F1D[] f)
Draw array of F1D holders- Parameters:
f
- array of F1D functions
-
draw
public void draw(jplot.DataArray inputDA, int index)
Draw input data represented by DataArray- Parameters:
inputDA
- input data container
-
draw
public boolean draw(F1D f1)
Draw an one-dimensional function. Range is determined by the setRange() method. If You set range during F1D initialization, it will be used. If not, canvas range is used.- Parameters:
f1
- F1D functionreturn
- true if success
-
draw
public boolean draw(F1D f1, double min, double max)
Draw a function in a range. Y range is set by autorange.- Parameters:
f1
-min
- min X valuemax
- max Y value- Returns:
-
draw
public boolean draw(FND f1)
Draw an one-dimensional function from FND- Parameters:
f1
- FND functionreturn
- true if success
-
draw
public boolean draw(F1D f1, boolean startZero)
Draw an one-dimensional function. Suppress negative values (useful for showing together with a histogram). If You set range during F1D initialization, it will be used. If not, canvas range is used.- Parameters:
f1
- F1D functionstartZero
- if true, start from 0 on Y- Returns:
- true if success
-
draw
public boolean draw(FND f1, boolean startZero)
Draw an one-dimensional function from FND. Suppress negative values (useful for showing together with a histogram).- Parameters:
f1
- FND functionstartZero
- if true, start from 0 on Y- Returns:
- true if success
-
getData
public java.util.Vector<jplot.DataArray>[][] getData()
Get the vector which keeps all the data- Returns:
- Vector with the data
-
close
public void close()
Close the canvas (and dispose all components).
-
quit
public void quit()
Quit the canvas (and dispose all components) Note: a memory leak is found - no time to study it. set to null all the stuff
-
removeGraph
public void removeGraph()
Remove all components from the JHPlot frame. Only keeps the empty central panel and 4 margins
-
draw
public void draw(P1D[] d)
Draw array of P1D holders- Parameters:
d
- array of P1D data holders
-
draw
public void draw(P1D d)
Draw data in form of P1D- Parameters:
d
- P1D container
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG