jhplot
Class HPlotJa
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- jhplot.HPlotJa
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- Direct Known Subclasses:
- SHPlotJa
public class HPlotJa extends javax.swing.JComponentA canvas to display all graphical DataMelt objects. Can be used for drawing Feynman diagrams and plot H1D, P1D, F1D and H2D objects. It is analogies to HPlot canvas but all plotted objects are much more interactive. It also include interactive editor to edit plots or show some graphics.- See Also:
HPlot, Serialized Form
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field and Description static intExponentstatic java.lang.StringJAVA_CLASSPATHThe current Java class path.static java.lang.StringJAVA_HOMEThe directory where Java is installed on the current machine.static java.lang.StringJAVA_RUNTIME_VERSIONThe current Java runtime version.static java.lang.StringJAVA_VERSIONThe current Java version.static intKeystatic intLabelXstatic intLabelYstatic java.lang.StringOS_ARCHThe architecture of the current operating system.static java.lang.StringOS_NAMEThe name of the current operating system.static java.lang.StringOS_VERSIONThe version of the current operating system.static java.lang.StringPREFS_FILENAMEThe file where user-selected preferences will be stored.static intStatBoxstatic intTitlestatic java.lang.StringUSER_HOMEThe current user's home directory.static java.lang.StringUSER_NAMEThe current user.static java.lang.StringVERSIONThe current version of japlot.jaxodraw.static java.lang.StringVERSION_NUMBERThe version number of this release of japlot.jaxodraw.static java.lang.StringWEB_SITEThe japlot.jaxodraw web site.-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor and Description HPlotJa()Construct a japlot.jaxodraw canvas with a plot with the default parameters 600 by 400, and 10% space for the global titleHPlotJa(java.lang.String title)Construct a japlot.jaxodraw canvas with a plot with the default parameters 600 by 400, and 10% space for the global titleHPlotJa(java.lang.String title, int xs, int ys)Construct a canvas with a single plot region.HPlotJa(java.lang.String title, int xsize, int ysize, int n1, int n2)Create HPlotJa canvas with several pads and axes.HPlotJa(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean setgraph)Create HPlotJa canvas with several pads.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(JaObject ob)Add an object to the frame.voidaddKey(jplot.DataArray data, int padx, int pady)voidaddStatBox(int padx, int pady)voidaddToBack(JaObject ob)Add an object to background.voidaddToFront(JaObject ob)Add an object to foreground.IAnalysisFactoryanalF()Return IAnalysisFactory associated with the plotvoidbuildPads(int n1, int n2)Build axes frames and show them.voidcd(int cols, int rows)Navigate to a selected plot.voidclearAll()Clear the canvas from all objectsvoidclearAllData()Clear all data from all graphs.voidclearData()Clear the axis frame from the data for the current pad.voidclearData(int padx, int pady)Clear the axis frame from the datavoidclose()Close the canvas (and dispose all components).voidconvertSVG(java.lang.String source, java.lang.String target)Export SVG to various image formats.voidconvertSVG(java.lang.String source, java.lang.String target, boolean isRemove)Export SVG to various image formats.voiddoc()Show online documentation.voiddraw(Cloud1D c1d)Plot cloud in 1D.voiddraw(Cloud2D c2d)Plot cloud 2Dvoiddraw(jplot.DataArray inputDA, java.lang.String title)Draw data represented by DataArray on the current pad.voiddraw(F1D f1)Draw an one-dimensional function on the current pad.voiddraw(F1D[] f)Draw array of F1D holdersvoiddraw(F1D f1, int padx, int pady)Draw an one-dimensional function on the current pad.voiddraw(FND f1)Draw an one-dimensional function on the current pad.voiddraw(FND f1, int padx, int pady)Draw an one-dimensional function on the current pad.voiddraw(H1D h1)Draw H1D histogram on the current pad.voiddraw(H1D h1, int padx, int pady)Draw H1D histogram on pad X and pad Yvoiddraw(H2D h2d)Draw H2D histogram on the current pad.voiddraw(H2D h2, int padx, int pady)Draw 2D histogram on pads given by X and Y.voiddraw(Histogram1D h1d)Draw 1D histogramvoiddraw(JaObject jo)Draw JaObject.voiddraw(P1D p1d)Draw H2D histogram on the current pad.voiddraw(P1D[] d)Draw array of P1D holdersvoiddraw(P1D p1d, int padx, int pady)Draw P1D object on the padvoidexport(java.lang.String file)Fast export of the canvas to an image file (depends on the extension, i.e.voidfactories()Create various JAIDA factories: IAnalysisFactory, ITree, IFitFactory, IFunctionFactoryintfit(H1D h1, java.lang.String predefFunc, java.lang.String method)Fit 1D histogram with the function F1DIFitFactoryfitF()Return FitFactory associated with the plotIFunctionFactoryfuncF()Return FunctionFactory associated with the plotjava.util.ArrayListgetArrayList()Get list of all objects on the frame.java.awt.ColorgetBoxColor()Returns the color used to draw the bounding box.java.awt.ColorgetBoxFillColor()Returns the fill-color of the eventual bounding box arround the graphintgetCdX()Get location of the graph in the main canvas in XintgetCdY()Get location of the graph on the main canvas in YintgetContourBinsX()Number of contour bins in XintgetContourBinsY()Number of contour bins in YintgetContourLevels()Number of contour levelsstatic java.lang.StringgetCurDir()Returns the current working directory.java.util.Vector<jplot.DataArray>getData()Get the vector which keeps all the dataJaTextgetGTitle()Get global titleJaAxesgetJaAxes()Get the current JaAxes framedoublegetKeyTextSpace()Get current space between the key symbol and the text for legendsJaTextgetLabel(int axis)Return the current lableJaText[][]getLabelsAll(int axis)Get labels from all pads.java.util.ArrayList<JaKey>getLegends()Return all the keys used for data annotationdoublegetMarginBottom()Get size of bottom margindoublegetMarginLeft()Get margin from left sidedoublegetMarginRight()Get margin from rightdoublegetMarginTop()Get the size of the top margindoublegetMarginX()Get margin in X between padsdoublegetMarginY()Get space between any 2 plots in YintgetNtotX()Get the total number of graphs in XintgetNtotY()Get the total number of the graphs in YJaAxesgetPad()Get current pad objectJaAxesgetPad(int n1, int n2)Get pad characterised by n1 and n2doublegetPadHeight()Get the height of the current pad in NDC system.doublegetPadPositionX()Get the position of the current pad in X (NDC coordinate)doublegetPadPositionY()Get the position of the current pad in Y (in NDC coordinate)doublegetPadWidth()Get the width of the current pad in NDC system.static voidgetPreferences()Checks whether preferences have been saved from an earlier session and if yes, imports them.intgetSizeX()get X sizeintgetSizeY()get Y sizejava.lang.String[]getStatistics(H1D h1)Get statistics in form of stringsjava.lang.String[]getStatistics(P1D h1)Get strings representing the statistics for the given objectstatic intgetSymbol(jplot.DataArray d)IHistogramFactoryhistF()Return IHistogramFactory associated with the plotbooleanisContour()is contour plot?booleanisContourBar()Show a bar indicating levels on contour plotbooleanisShowStatBox()Is stat box is shown on the current pad?static voidmain(java.lang.String[] args)The main method of japlot.jaxodraw: determines system properties, preferences and command line arguments, before bringing up the graphical user interface.voidremoveAxes()remove X and Y axes, tics, axis labels on the current plot.voidremoveObject(int type, int padx, int pady)Remove a particular objectvoidsetAntiAlias(boolean setit)Set antialiasing for the graphics of the current plotvoidsetAutoRange()Set autorange in X and Y at the same time for the current plotvoidsetAutoRange(boolean b)Set autorange in X and Y at the same timevoidsetAutoRange(int axis, boolean b)Sets true or false to use automatic scaling for the current plot.voidsetAutoRangeAll()Set autorange in X and Y at the same time for all plotsvoidsetAutoRangeAll(boolean b)Set auto-range in X and Y at the same time for all plotsvoidsetAutoRangeAll(int axis, boolean b)Sets true or false to use automatic scaling for all plots.voidsetAxesFrame(int n1, int n2)Set axes frames or pads.voidsetAxisAll(boolean show)Sets whether all axis lines will be drawn or not.voidsetBoxColor(java.awt.Color c)Sets the color of the bounding box drawn around a graph.voidsetBoxFillColor(java.awt.Color c)Sets the fill color of the bounding box drawn around a graph.voidsetContour(boolean contour)Set to a contour stylevoidsetContourBar(boolean bar)Show a bar indicating levels on contour plotvoidsetContourBins(int nX, int nY)Set number of contour bins in X and YvoidsetContourLevels(int levels)Number of contour levelsstatic voidsetCurDir(java.lang.String newDir)Sets the current working directory.voidsetGridAll(int axis, boolean b)Sets or not the grid lines for all plots on the same canvasvoidsetGTitle(JaText gTitle)Set the global titlevoidsetGTitle(java.lang.String sname)Set the global title with default attributes.voidsetGTitle(java.lang.String sname, java.awt.Color color)Set the global title with default attributes.voidsetGTitle(java.lang.String sname, java.awt.Font f)Sets the global title using black color.voidsetGTitle(java.lang.String sname, java.awt.Font f, java.awt.Color c)Sets the global titlevoidsetKeyTextSpace(double space)Set space between the key symbol and the text in a legend.voidsetLabel(int axis, double x, double y, java.lang.String text)Set label (or update it) for the current pad selected with the cd(i1,i2) method.voidsetLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f)Set label (or update it) for the current pad selected with the cd(i1,i2) method.voidsetLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f, java.awt.Color c)Set label (or update it) for the current pad selected with the cd(i1,i2) method.voidsetLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f, java.awt.Color c, java.lang.String howToSet)Set label (or update it) for the current pad selected with the cd(i1,i2) method.voidsetLabelShift(int axis, double shiftX, double shiftY)Shift position of a label with respect to the axis by about defined in NDC (0-1).voidsetLabelX(java.lang.String label, int n1, int n2)Sets a label for X at the default locationvoidsetLabelY(java.lang.String label, int n1, int n2)Set label at the default positionvoidsetLegendAll(boolean isSet)Do we need to show legends?voidsetLegendFont(java.awt.Font font)Sets the actual font of the legend.voidsetLegendFont(java.lang.String name)Set the label font, which is used for axis labels and legend labels.voidsetLegends(java.util.ArrayList<JaKey> legends)Set new list of legends (old legends are removed).voidsetLocationAtCenter(JaText text)Sets the location of a text object at the center of the canvasvoidsetLogScale(int axis, boolean b)Sets true or false to plot on a log scale.voidsetMarginBottom(double marginBottom)Margin from bottom in NDC coordinates (0-1).voidsetMarginLeft(double marginLeft)Margin from lef.voidsetMarginRight(double marginRight)Set margin from right.voidsetMarginTop(double marginTop)Set margin from top in NDC system.voidsetMarginX(double marginX)Margin in X between padsvoidsetMarginY(double marginY)Margin in Y between padsvoidsetNameX(java.lang.String s)Sets the name for X axis.voidsetNameX(java.lang.String s, java.awt.Font f)Sets the name for X axis.voidsetNameX(java.lang.String s, java.awt.Font f, java.awt.Color c)Set the label for the axis in XvoidsetNameY(java.lang.String s)Sets the name for Y axis.voidsetNameY(java.lang.String s, java.awt.Font f)Sets the name for Y axis.voidsetNameY(java.lang.String s, java.awt.Font f, java.awt.Color c)Set the label for the axis in YvoidsetPad(double xpos, double ypos, double width, double height)Set the location and the size of the current pad in NDC coordinate.voidsetPad(int padx, int pady, double xpos, double ypos)Set the location and the size of the pad in NDC coordinate.voidsetPad(int padx, int pady, double xpos, double ypos, double width, double height)Set the location and the size of the pad in NDC coordinate.voidsetPadLocation(double x, double y)Set location of the current pad in NDC (0-1).voidsetPadSize(double width, double height)Set width and height of the pad in NDC.voidsetRange(double minX, double maxX, double minY, double maxY)Set ranges on X and Y on the current pad.voidsetRangeX(double min, double max)Set range on X.voidsetRangeX(double min, double max, int padx, int pady)Set X range on pad defined by x and y on the canvas.voidsetRangeY(double min, double max)Set range on Y on the current pad.voidsetRangeY(double min, double max, int padx, int pady)Set Y range on pad defined by x and y on the canvas.voidsetShowMirror(int axis, boolean set)Set or no a mirror axisvoidsetShowStatBox(boolean showStatBox)Show a box with statistics (only for last plotted object) on the current padvoidsetStatBox(java.lang.String[] label, int n1, int n2)Set statistical box.voidsetTicFont(java.awt.Font font)Sets the font used by the labels drawn at each tick.voidsetTicksLabels(int axis, boolean set)Set tick labels for the current padvoidshowAxis(int axis)Show a particular axis (no mirror)voidshowEditor()Show object editor on the left of the canvas.voidshowEditor(boolean show)Show object editor (or not)voidshowKey(boolean show)Show or not keys for the current plotITreetreeF()Return TreeFactory associated with the plotvoidupdate()Update the canvas by repainting all objectsvoidvisible()Set the canvas frame visiblevoidvisible(boolean vs)Set the canvas frame visible or notvoidvisible(int posX, int posY)Set the canvas frame visible.-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
LabelX
public static final int LabelX
- See Also:
- Constant Field Values
-
LabelY
public static final int LabelY
- See Also:
- Constant Field Values
-
Title
public static final int Title
- See Also:
- Constant Field Values
-
StatBox
public static final int StatBox
- See Also:
- Constant Field Values
-
Exponent
public static final int Exponent
- See Also:
- Constant Field Values
-
Key
public static final int Key
- See Also:
- Constant Field Values
-
VERSION_NUMBER
public static final java.lang.String VERSION_NUMBER
The version number of this release of japlot.jaxodraw.- See Also:
- Constant Field Values
-
VERSION
public static final java.lang.String VERSION
The current version of japlot.jaxodraw.- See Also:
- Constant Field Values
-
WEB_SITE
public static final java.lang.String WEB_SITE
The japlot.jaxodraw web site.- See Also:
- Constant Field Values
-
USER_NAME
public static final java.lang.String USER_NAME
The current user.
-
USER_HOME
public static final java.lang.String USER_HOME
The current user's home directory.
-
OS_NAME
public static final java.lang.String OS_NAME
The name of the current operating system.
-
OS_ARCH
public static final java.lang.String OS_ARCH
The architecture of the current operating system.
-
OS_VERSION
public static final java.lang.String OS_VERSION
The version of the current operating system.
-
JAVA_VERSION
public static final java.lang.String JAVA_VERSION
The current Java version.
-
JAVA_RUNTIME_VERSION
public static final java.lang.String JAVA_RUNTIME_VERSION
The current Java runtime version.
-
JAVA_HOME
public static final java.lang.String JAVA_HOME
The directory where Java is installed on the current machine.
-
JAVA_CLASSPATH
public static final java.lang.String JAVA_CLASSPATH
The current Java class path.
-
PREFS_FILENAME
public static java.lang.String PREFS_FILENAME
The file where user-selected preferences will be stored.
-
-
Constructor Detail
-
HPlotJa
public HPlotJa(java.lang.String title, int xsize, int ysize, int n1, int n2, boolean setgraph)Create HPlotJa canvas with several pads.- Parameters:
title- Titlexsize- size in x directionysize- size in y directionn1- number of plots/graphs in xn2- number of plots/graphs in ysetgraph- true if initials graph with axes should be set Set to false if you want just empty canvas.
-
HPlotJa
public HPlotJa(java.lang.String title, int xsize, int ysize, int n1, int n2)Create HPlotJa canvas with several pads and axes.- Parameters:
title- Titlexsize- size in x directionysize- size in y directionn1- number of plots/graphs in xn2- number of plots/graphs in y
-
HPlotJa
public HPlotJa(java.lang.String title, int xs, int ys)Construct a canvas with a single plot region.- Parameters:
title- Title for the canvasxs- size of canvas in xys- size of canvas in y
-
HPlotJa
public HPlotJa()
Construct a japlot.jaxodraw canvas with a plot with the default parameters 600 by 400, and 10% space for the global title
-
HPlotJa
public HPlotJa(java.lang.String title)
Construct a japlot.jaxodraw canvas with a plot with the default parameters 600 by 400, and 10% space for the global title- Parameters:
title- Title
-
-
Method Detail
-
setAxesFrame
public void setAxesFrame(int n1, int n2)Set axes frames or pads. Before creating pad, clear the canvas, i.e. call clearAll(0 and clearData(). One should also call update() to show the pads.- Parameters:
n1- number of pads in Xn2- number of pads in Y
-
buildPads
public void buildPads(int n1, int n2)Build axes frames and show them. In fact, it calls the methods: clearAllData(); clearAll(); setAxesFrame(n1,n2); update();.- Parameters:
n1- number of pads in Xn2- number of pads in Y
-
cd
public void cd(int cols, int rows)Navigate to a selected plot. This is necessary if there are a several plots on the same canvas.- Parameters:
cols- Set the location of the current plot in xrows- Set the location of the current plot in y
-
getCdX
public int getCdX()
Get location of the graph in the main canvas in X- Returns:
- location of the graph in X
-
getNtotX
public int getNtotX()
Get the total number of graphs in X- Returns:
- Total number of graphs in X
-
getNtotY
public int getNtotY()
Get the total number of the graphs in Y- Returns:
- Total number of graphs in Y
-
getCdY
public int getCdY()
Get location of the graph on the main canvas in Y- Returns:
- location in Y
-
getJaAxes
public JaAxes getJaAxes()
Get the current JaAxes frame- Returns:
- frame
-
setContour
public void setContour(boolean contour)
Set to a contour style- Parameters:
contour- set to true for contour style
-
setContourBar
public void setContourBar(boolean bar)
Show a bar indicating levels on contour plot- Parameters:
bar- true if the bar is shown
-
setContourLevels
public void setContourLevels(int levels)
Number of contour levels- Parameters:
levels- number of contour levels
-
getContourLevels
public int getContourLevels()
Number of contour levels- Parameters:
levels- number of contour levels
-
isContourBar
public boolean isContourBar()
Show a bar indicating levels on contour plot- Parameters:
bar- true if the bar is shown
-
setContourBins
public void setContourBins(int nX, int nY)Set number of contour bins in X and Y- Parameters:
number- of bins in Xnumber- of bins in Y
-
isContour
public boolean isContour()
is contour plot?- Returns:
-
getContourBinsX
public int getContourBinsX()
Number of contour bins in X- Returns:
-
getContourBinsY
public int getContourBinsY()
Number of contour bins in Y- Returns:
-
add
public void add(JaObject ob)
Add an object to the frame. Typically, you will need to call "update" to trigger redraw.- Parameters:
ob- input object
-
addToBack
public void addToBack(JaObject ob)
Add an object to background. Typically, you will need to call "update" to trigger redraw.- Parameters:
ob- input object
-
addToFront
public void addToFront(JaObject ob)
Add an object to foreground.- Parameters:
ob- input object
-
clearAll
public void clearAll()
Clear the canvas from all objects
-
clearAllData
public void clearAllData()
Clear all data from all graphs.
-
clearData
public void clearData(int padx, int pady)Clear the axis frame from the data- Parameters:
padx- No of pads in Xpady- No of pads in Y
-
setPad
public void setPad(double xpos, double ypos, double width, double height)Set the location and the size of the current pad in NDC coordinate. First, navigate to this pad using the cd(i,j) method.- Parameters:
padx- pad ID in Xpady- pad ID in Yxpos- pad location in Xypos- pad location in Ywidth- pad width in Xhight- pad height in Y
-
getPadPositionX
public double getPadPositionX()
Get the position of the current pad in X (NDC coordinate)- Returns:
- pad position in X
-
getPadPositionY
public double getPadPositionY()
Get the position of the current pad in Y (in NDC coordinate)- Returns:
- position in Y
-
getPadWidth
public double getPadWidth()
Get the width of the current pad in NDC system.- Returns:
- width
-
getPadHeight
public double getPadHeight()
Get the height of the current pad in NDC system.- Returns:
- height
-
setPad
public void setPad(int padx, int pady, double xpos, double ypos, double width, double height)Set the location and the size of the pad in NDC coordinate. First, navigate to this pad using the cd(i,j) method.- Parameters:
padx- pad ID in Xpady- pad ID in Yxpos- pad location in Xypos- pad location in Ywidth- pad width in Xhight- pad height in Y
-
setPad
public void setPad(int padx, int pady, double xpos, double ypos)Set the location and the size of the pad in NDC coordinate. First, navigate to this pad using the cd(i,j) method.- Parameters:
padx- pad ID in Xpady- pad ID in Yxpos- pad location in Xypos- pad location in Y
-
removeObject
public void removeObject(int type, int padx, int pady)Remove a particular object- Parameters:
type- type of this objectpadx- padpady- pad
-
getArrayList
public java.util.ArrayList getArrayList()
Get list of all objects on the frame.
-
clearData
public void clearData()
Clear the axis frame from the data for the current pad.
-
update
public void update()
Update the canvas by repainting all objects
-
close
public void close()
Close the canvas (and dispose all components).
-
setLocationAtCenter
public void setLocationAtCenter(JaText text)
Sets the location of a text object at the center of the canvas- Parameters:
text- input text object
-
setAxisAll
public void setAxisAll(boolean show)
Sets whether all axis lines will be drawn or not.- Parameters:
show- toggle, true if the axis should be drawn.
-
removeAxes
public void removeAxes()
remove X and Y axes, tics, axis labels on the current plot.
-
setTicksLabels
public void setTicksLabels(int axis, boolean set)Set tick labels for the current pad- Parameters:
axis- axis id (0- X, 1- Y)set- set to true, if you want to show it
-
setShowMirror
public void setShowMirror(int axis, boolean set)Set or no a mirror axis- Parameters:
axis- axis id (0- X, 1- Y)set- set to true, if you want to show it
-
showAxis
public void showAxis(int axis)
Show a particular axis (no mirror)- Parameters:
axis- 0 for X, 1 for Y
-
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
-
setLabelX
public void setLabelX(java.lang.String label, int n1, int n2)Sets a label for X at the default location- Parameters:
label- current labeln1- pad position in X (-1)n2- pad position in Y (-1)
-
setLabel
public void setLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f, java.awt.Color c, java.lang.String howToSet)Set label (or update it) for the current pad selected with the cd(i1,i2) method. After setting a new label, use "update()" method to apply changes- Parameters:
axis- axis. 0 means X, 1 means Yx- X-position in the NDCy- Y-position in NDCtext- textf- font of this labelc- Color of this labelhowToSet- How to set. Use "NDC" (coordinate independent, between 0 and 1) or USER (depends on the plotted coordinates)
-
setLabel
public void setLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f, java.awt.Color c)Set label (or update it) for the current pad selected with the cd(i1,i2) method. This method uses NDC as the default frame for label position. After setting a new label, use "update()" method to apply changes- Parameters:
axis- axis. 0 means X, 1 means Yx- X-position in the NDCy- Y-position in NDCtext- textf- font of this labelc- Color of this label
-
setLabel
public void setLabel(int axis, double x, double y, java.lang.String text, java.awt.Font f)Set label (or update it) for the current pad selected with the cd(i1,i2) method. This method uses NDC as the default frame for label position. After setting a new label, use "update()" method to apply changes- Parameters:
axis- axis. 0 means X, 1 means Yx- X-position in the NDCy- Y-position in NDCtext- textf- font of this label
-
setLabel
public void setLabel(int axis, double x, double y, java.lang.String text)Set label (or update it) for the current pad selected with the cd(i1,i2) method. This method uses NDC as the default frame for label position. After setting a new label, use "update()" method to apply changes- Parameters:
axis- axis. 0 means X, 1 means Yx- X-position in the NDCy- Y-position in NDCtext- text
-
getLabel
public JaText getLabel(int axis)
Return the current lable- Parameters:
axis- if 0 then for X-axis, if 1 then Y-axis- Returns:
- object representing this label
-
setLabelShift
public void setLabelShift(int axis, double shiftX, double shiftY)Shift position of a label with respect to the axis by about defined in NDC (0-1). Applied for the current pad. To trigger redraw, call update() method.- Parameters:
axis- axis. 0 means Y, 1 means YshiftX- value for the shift in X directionshiftY- value for the shift in Y direction
-
setStatBox
public void setStatBox(java.lang.String[] label, int n1, int n2)Set statistical box.- Parameters:
label- textn1- pad ID in X (-1)n2- pad ID in Y (-1)
-
setLabelY
public void setLabelY(java.lang.String label, int n1, int n2)Set label at the default position- Parameters:
label- text of the Y labeln1- pad ID in X (-1)n2- pad ID in Y (-1)
-
getPreferences
public static void getPreferences()
Checks whether preferences have been saved from an earlier session and if yes, imports them.
-
getSizeX
public int getSizeX()
get X size
-
getSizeY
public int getSizeY()
get Y size
-
getCurDir
public static java.lang.String getCurDir()
Returns the current working directory.- Returns:
- The current working directory.
-
setCurDir
public static void setCurDir(java.lang.String newDir)
Sets the current working directory.- Parameters:
newDir- The new working directory.
-
setRangeX
public void setRangeX(double min, double max)Set range on X. Call update method to redraw.- Parameters:
min- min value on Xmax- max value ob X
-
setRangeY
public void setRangeY(double min, double max)Set range on Y on the current pad. Call update method to redraw.- Parameters:
min- min value on Ymax- max value on Y
-
setRange
public void setRange(double minX, double maxX, double minY, double maxY)Set ranges on X and Y on the current pad. Call update method to redraw.- Parameters:
minX- min value on XmaxX- max value on XminY- min value on YmaxY- max value on Y
-
setRangeX
public void setRangeX(double min, double max, int padx, int pady)Set X range on pad defined by x and y on the canvas.- Parameters:
min- Min value on Xmax- Max vallue on Xpadx- pad in Xpady- pad in Y
-
setRangeY
public void setRangeY(double min, double max, int padx, int pady)Set Y range on pad defined by x and y on the canvas.- Parameters:
min- Min value on Ymax- Max vallue on Ypadx- pad in Xpady- pad in Y
-
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 if X, 1 if Y).b- toggle, true if the scaling is logarithmic
-
setTicFont
public void setTicFont(java.awt.Font font)
Sets the font used by the labels drawn at each tick.- Parameters:
font- the new font
-
showEditor
public void showEditor()
Show object editor on the left of the canvas.
-
showEditor
public void showEditor(boolean show)
Show object editor (or not)- Parameters:
show- true then show it
-
export
public void export(java.lang.String file)
Fast export of the canvas to an image file (depends on the extension, i.e. PNG, JPG, EPS, PS, SVG). No questions will be asked, an existing file will be rewritten- Parameters:
file- Output file with the proper extension. If no extension, PNG file is assumed.
-
convertSVG
public void convertSVG(java.lang.String source, java.lang.String target)Export SVG to various image formats. Supported output: JPEG
PNG
PS
EPS
PDF
SVGZ- Parameters:
source- Input file in SVG formattarget- Output file in designed format.
-
convertSVG
public void convertSVG(java.lang.String source, java.lang.String target, boolean isRemove)Export SVG to various image formats. Supported output: JPEG
PNG
PS
EPS
PDF
SVGZ- Parameters:
source- Input file in SVG formattarget- Output file in designed format.isRemove- true if the source should be removed.
-
getPad
public JaAxes getPad()
Get current pad object- Returns:
- pad
-
getKeyTextSpace
public double getKeyTextSpace()
Get current space between the key symbol and the text for legends- Returns:
- space defined in NDC
-
setKeyTextSpace
public void setKeyTextSpace(double space)
Set space between the key symbol and the text in a legend.- Parameters:
space- space to be set in NDC
-
getPad
public JaAxes getPad(int n1, int n2)
Get pad characterised by n1 and n2- Parameters:
n1- location of pad in Xn2- location of pad in Y- Returns:
- pad
-
setMarginBottom
public void setMarginBottom(double marginBottom)
Margin from bottom in NDC coordinates (0-1).- Parameters:
marginBottom- margin from botton.
-
getMarginBottom
public double getMarginBottom()
Get size of bottom margin- Returns:
- size
-
setMarginLeft
public void setMarginLeft(double marginLeft)
Margin from lef. Shoule be in NDC coordinates (0-1)- Parameters:
marginLeft- left margin (0-1)
-
getMarginLeft
public double getMarginLeft()
Get margin from left side- Returns:
- marginLeft
-
setMarginRight
public void setMarginRight(double marginRight)
Set margin from right. NDC is assumed (0-1).- Parameters:
marginRight- margin from right.
-
getMarginRight
public double getMarginRight()
Get margin from right- Returns:
- marginRight
-
setAntiAlias
public void setAntiAlias(boolean setit)
Set antialiasing for the graphics of the current plot- Parameters:
setit- true if antialiasing is set
-
setLegendFont
public void setLegendFont(java.awt.Font font)
Sets the actual font of the legend.- Parameters:
font- new font to draw the legend.
-
getLegends
public java.util.ArrayList<JaKey> getLegends()
Return all the keys used for data annotation- Returns:
- array with legends
-
setLegends
public void setLegends(java.util.ArrayList<JaKey> legends)
Set new list of legends (old legends are removed).- Parameters:
new- legends
-
setLegendAll
public void setLegendAll(boolean isSet)
Do we need to show legends?- Parameters:
isSet- false, then legends are removed.
-
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.
-
setPadLocation
public void setPadLocation(double x, double y)Set location of the current pad in NDC (0-1). You may need to call update.- Parameters:
x- positiony- position
-
setPadSize
public void setPadSize(double width, double height)Set width and height of the pad in NDC. Allowed values (0-1).- Parameters:
width- widthwidth- height
-
setMarginTop
public void setMarginTop(double marginTop)
Set margin from top in NDC system.- Parameters:
marginTop- margin in NDC (0-1).
-
getMarginTop
public double getMarginTop()
Get the size of the top margin- Returns:
- top margin
-
setMarginX
public void setMarginX(double marginX)
Margin in X between pads- Parameters:
marginX-
-
getMarginX
public double getMarginX()
Get margin in X between pads- Returns:
- margin in X
-
setMarginY
public void setMarginY(double marginY)
Margin in Y between pads- Parameters:
marginY- space in Y between pads
-
getMarginY
public double getMarginY()
Get space between any 2 plots in Y- Returns:
- space between plots in Y
-
getLabelsAll
public JaText[][] getLabelsAll(int axis)
Get labels from all pads.- Parameters:
axis- 0 for X, 1 for Y- Returns:
- labels
-
draw
public void draw(H1D h1, int padx, int pady)
Draw H1D histogram on pad X and pad Y- Parameters:
h1- input histogrampadx- No of pads in Xpady- No of pads in Y
-
showKey
public void showKey(boolean show)
Show or not keys for the current plot- Parameters:
show- true if shown
-
addKey
public void addKey(jplot.DataArray data, int padx, int pady)
-
setShowStatBox
public void setShowStatBox(boolean showStatBox)
Show a box with statistics (only for last plotted object) on the current pad- Parameters:
showStatBox-
-
isShowStatBox
public boolean isShowStatBox()
Is stat box is shown on the current pad?- Returns:
- true if shown
-
addStatBox
public void addStatBox(int padx, int pady)
-
getSymbol
public static int getSymbol(jplot.DataArray d)
-
draw
public void draw(H2D h2, int padx, int pady)
Draw 2D histogram on pads given by X and Y. The contour style is used.- Parameters:
h2- input histogrampadx- index of pad in Xpady- index of pad in Y
-
setGTitle
public void setGTitle(JaText gTitle)
Set the global title- Parameters:
gTitle- object representing global title
-
setGTitle
public void setGTitle(java.lang.String sname, java.awt.Font f, java.awt.Color c)Sets the global title- Parameters:
sname- Titlef- Fontc- Color
-
setGTitle
public void setGTitle(java.lang.String sname, java.awt.Font f)Sets the global title using black color.- Parameters:
sname- Title namef- Font
-
setGTitle
public void setGTitle(java.lang.String sname)
Set the global title with default attributes. The default color is black. The default font is ("Arial", Font.BOLD, 20)- Parameters:
sname- Title
-
setGTitle
public void setGTitle(java.lang.String sname, java.awt.Color color)Set the global title with default attributes. The default color is black. The default font is ("Arial", Font.BOLD, 20)- Parameters:
sname- Titlecolor- Color of the title
-
getGTitle
public JaText getGTitle()
Get global title- Returns:
-
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
-
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
-
setNameY
public void setNameY(java.lang.String s, java.awt.Font f, java.awt.Color c)Set the label for the axis in Y- Parameters:
s- label titlef- Fontc- Color
-
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.
-
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.
-
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
-
draw
public void draw(JaObject jo)
Draw JaObject. Use update() method to actually show it. This method is the same ad add method.- Parameters:
jo- input JaObject
-
draw
public void draw(P1D p1d)
Draw H2D histogram on the current pad. Use update() method to actually show it.- Parameters:
h2d- input histogram
-
draw
public void draw(H2D h2d)
Draw H2D histogram on the current pad.- Parameters:
h2d- input histogram
-
getStatistics
public java.lang.String[] getStatistics(H1D h1)
Get statistics in form of strings- Parameters:
h1- input H1D- Returns:
- lines with statistics
-
getStatistics
public java.lang.String[] getStatistics(P1D h1)
Get strings representing the statistics for the given object- Parameters:
h1- input P1D- Returns:
- lines with statistics
-
draw
public void draw(H1D h1)
Draw H1D histogram on the current pad. Use update() method to actually show it.- Parameters:
h1- input histogram
-
draw
public void draw(F1D[] f)
Draw array of F1D holders- Parameters:
f- array of F1D functions
-
draw
public void draw(Cloud1D c1d)
Plot cloud in 1D. Assume 100 bins.- Parameters:
c1d- Input Cloud1D
-
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
-
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
-
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
-
draw
public void draw(jplot.DataArray inputDA, java.lang.String title)Draw data represented by DataArray on the current pad.- Parameters:
inputDA- input data container
-
draw
public void draw(F1D f1, int padx, int pady)
Draw an one-dimensional function on the current pad. * If You set range during F1D initialization, it will be used. If not, canvas range is used.- Parameters:
f1- input functionpadx- pad in Xpady- pad in Y
-
draw
public void draw(FND f1, int padx, int pady)
Draw an one-dimensional function on the current pad.- Parameters:
f1- input functionpadx- pad in Xpady- pad in Y
-
draw
public void draw(F1D f1)
Draw an one-dimensional function on the current pad.- Parameters:
f1- input function
-
draw
public void draw(FND f1)
Draw an one-dimensional function on the current pad.- Parameters:
f1- input function
-
draw
public void draw(P1D p1d, int padx, int pady)
Draw P1D object on the pad- Parameters:
p1d- inputpadx- pad in Xpady- pad in Y
-
draw
public void draw(P1D[] d)
Draw array of P1D holders- Parameters:
d- array of P1D data holders
-
getData
public java.util.Vector<jplot.DataArray> getData()
Get the vector which keeps all the data- Returns:
- Vector with the data
-
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
-
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
-
main
public static void main(java.lang.String[] args)
The main method of japlot.jaxodraw: determines system properties, preferences and command line arguments, before bringing up the graphical user interface.- Parameters:
args- The array of command line arguments.
-
doc
public void doc()
Show online documentation.
-
-
DMelt 3.0 © DataMelt by jWork.ORG