Class Plot2DPanelOJ
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.math.plot.PlotPanel
org.openjump.core.ui.plot.Plot2DPanelOJ
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
public class Plot2DPanelOJ
extends org.math.plot.PlotPanel
Class suitable for plotting 2D data on a panel, to be added to a swing
container.
Class for ascending compatibility
- Author:
- Yann Richet
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class org.math.plot.PlotPanel
BAR, BOX, COLORLIST, EAST, GRID, HISTOGRAM, INVISIBLE, LINE, NORTH, plotCanvas, plotLegend, plotToolBar, SCATTER, SOUTH, STAIRCASE, WESTFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for Plot2DPanel.Plot2DPanelOJ(double[] min, double[] max, String[] axesScales, String[] axesLabels) Plot2DPanelOJ(String legendOrientation) Plot2DPanelOJ(org.math.plot.canvas.PlotCanvas _canvas) Plot2DPanelOJ(org.math.plot.canvas.PlotCanvas _canvas, String legendOrientation) -
Method Summary
Modifier and TypeMethodDescriptionintaddBarPlot(String name, double[] Y) intaddBarPlot(String name, double[][] XY) intaddBarPlot(String name, double[] X, double[] Y) intaddBarPlot(String name, Color color, double[] Y) intaddBarPlot(String name, Color color, double[][] XY) Adds a bar plot (each data point is shown as a dot marker connected to the horizontal axis by a vertical line) to the current plot panel.intaddBarPlot(String name, Color color, double[] X, double[] Y) intaddBarPlotOJ(String name, double[] Y, int[] fID, PlugInContext context, Layer layer) intaddBoxPlot(String name, double[][] XYdXdY) intaddBoxPlot(String name, double[][] XY, double[][] dXdY) intaddBoxPlot(String name, Color color, double[][] XYdXdY) Adds a box plot to the current plot panel.intaddBoxPlot(String name, Color color, double[][] XY, double[][] dXdY) Adds a box plot to the current plot panel.intaddCloudPlot(String name, double[][] sampleXY, int nX, int nY) intaddCloudPlot(String name, Color color, double[][] sampleXY, int nX, int nY) intaddHistogramPlot(String name, double[][] XYdX) Adds a histogram plot to the current plot panel.intaddHistogramPlot(String name, double[][] XY, double[] dX) intaddHistogramPlot(String name, double[] X, double... bounds) intaddHistogramPlot(String name, double[] X, double min, double max, int n) intaddHistogramPlot(String name, double[] X, int n) intaddHistogramPlot(String name, Color color, double[][] XYdX) intaddHistogramPlot(String name, Color color, double[][] XY, double[] dX) Adds a histogram plot to the current plot panel.intaddHistogramPlot(String name, Color color, double[] sample, double... bounds) Adds a plot of the statistical repartition of a sample, as a histogram.intaddHistogramPlot(String name, Color color, double[] X, double min, double max, int n) intaddHistogramPlot(String name, Color color, double[] sample, int n) Adds a plot of the statistical repartition of a sample, as a histogram.intaddHistogramPlotOJ(String name, double[] X, int n, PlugInContext context, Layer layer, String attrName) [sstein] method for OJUMPintaddLinePlot(String name, double[] Y) intaddLinePlot(String name, double[][] XY) intaddLinePlot(String name, double[] X, double[] Y) intaddLinePlot(String name, Color color, double[] Y) intaddLinePlot(String name, Color color, double[][] XY) Adds a line plot (each data point is connected to the next one by a solid line) to the current plot panel.intaddLinePlot(String name, Color color, double[] X, double[] Y) intintaddScatterPlot(String name, double[] Y) intaddScatterPlot(String name, double[][] XY) intaddScatterPlot(String name, double[] X, double[] Y) intaddScatterPlot(String name, Color color, double[] Y) intaddScatterPlot(String name, Color color, double[][] XY) Adds a scatter plot (each data point is plotted as a single dot marker) to the current plot panel.intaddScatterPlot(String name, Color color, double[] X, double[] Y) intaddScatterPlotOJ(String name, double[][] XY, int[] fID, PlugInContext context, Layer layer) [sstein] method for OpenJUMPintaddStaircasePlot(String name, double[] Y) intaddStaircasePlot(String name, double[][] XY) intaddStaircasePlot(String name, double[] X, double[] Y) intaddStaircasePlot(String name, Color color, double[] Y) intaddStaircasePlot(String name, Color color, double[][] XY) Adds a staircase plot (each data point is connected to the following one by a horizontal line then a vertical line) to the current plot panel.intaddStaircasePlot(String name, Color color, double[] X, double[] Y) Object[]getXData()Gets an array with data from X.Object[]getXData_limits(boolean maxvalue) gets the limit values of each interval of X data. maxvalue true= the upper value, maxvalue false= the lower valueObject[]getYData()Gets an array with data from Y.Object[]returns the cumulative frequancy of Y dataObject[]returns the relative frequancy of Y dataMethods inherited from class org.math.plot.PlotPanel
addBaseLabel, addGaussQuantilestoPlot, addGaussQuantilestoPlot, addLabel, addLegend, addPlot, addPlot, addPlotable, addPlotToolBar, addQuantilestoPlot, addQuantilestoPlot, addQuantiletoPlot, addQuantiletoPlot, addVectortoPlot, changePlotColor, changePlotData, changePlotName, getAxis, getAxisScales, getEditable, getFont, getNewColor, getNotable, getPlot, getPlotable, getPlotables, getPlotIndex, getPlots, getPlotToolBar, includeInBounds, includeInBounds, main, mapData, removeAllPlotables, removeAllPlots, removeLegend, removePlot, removePlot, removePlotable, removePlotable, removePlotToolBar, resetMapData, setActionMode, setAdjustBounds, setAutoBounds, setAutoBounds, setAxisLabel, setAxisLabels, setAxisScale, setAxisScales, setEditable, setFixedBounds, setFixedBounds, setFont, setLegendOrientation, setNotable, setNoteCoords, setPlot, setPlotToolBarOrientation, toGraphicFileMethods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
Plot2DPanelOJ
public Plot2DPanelOJ()Constructor for Plot2DPanel. Create a new blank instance of Plot2DPanel, to be added to a swing component. -
Plot2DPanelOJ
-
Plot2DPanelOJ
-
Plot2DPanelOJ
public Plot2DPanelOJ(org.math.plot.canvas.PlotCanvas _canvas) -
Plot2DPanelOJ
-
-
Method Details
-
addScatterPlot
Adds a scatter plot (each data point is plotted as a single dot marker) to the current plot panel.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- Pairs of array of double. First one contains the X position of the data points, second contains Y position.
Each array of the pair must be of the same length; if not a ArrayIndexOutOfBoundsException exception will be thrown.
Each data set must come in pair of array of double; if not a ArrayIndexOutOfBoundsException exception will be thrown.- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addScatterPlot
-
addScatterPlot
-
addScatterPlot
-
addScatterPlotOJ
public int addScatterPlotOJ(String name, double[][] XY, int[] fID, PlugInContext context, Layer layer) [sstein] method for OpenJUMP- Parameters:
name- name of the plotXY- data as a 2-dimensional array of doublefID- feature identifiers as an array of integerscontext- the PlugInContextlayer- layer
-
addScatterPlot
-
addScatterPlot
-
addLinePlot
Adds a line plot (each data point is connected to the next one by a solid line) to the current plot panel.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- Pairs of array of double. First one contains the X position of the data points, second contains Y position.
Each array of the pair must be of the same length; if not a ArrayIndexOutOfBoundsException exception will be thrown.
Each data set must come in pair of array of double; if not a ArrayIndexOutOfBoundsException exception will be thrown.- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addLinePlot
-
addLinePlot
-
addLinePlot
-
addLinePlot
-
addLinePlot
-
addBarPlot
Adds a bar plot (each data point is shown as a dot marker connected to the horizontal axis by a vertical line) to the current plot panel.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- Pairs of array of double. First one contains the X position of the data points, second contains Y position.
Each array of the pair must be of the same length; if not a ArrayIndexOutOfBoundsException exception will be thrown.
Each data set must come in pair of array of double; if not a ArrayIndexOutOfBoundsException exception will be thrown.- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addBarPlot
-
addBarPlot
-
addBarPlot
-
addBarPlot
-
addBarPlotOJ
-
addBarPlot
-
addStaircasePlot
Adds a staircase plot (each data point is connected to the following one by a horizontal line then a vertical line) to the current plot panel.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- Pairs of array of double. First one contains the X position of the data points, second contains Y position.
Each array of the pair must be of the same length; if not a ArrayIndexOutOfBoundsException exception will be thrown.
Each data set must come in pair of array of double; if not a ArrayIndexOutOfBoundsException exception will be thrown.- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addStaircasePlot
-
addStaircasePlot
-
addStaircasePlot
-
addStaircasePlot
-
addStaircasePlot
-
addBoxPlot
Adds a box plot to the current plot panel. Each data point is plotted as a dot marker at the center of a rectangle.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- m*2 array of array of double. Contains the x,y coordinates of the m boxes' center (m lines, 2 rows).dXdY- m*2 array of array of double. Contains the width and heigth of the m boxes (m lines, 2 rows).- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addBoxPlot
-
addBoxPlot
Adds a box plot to the current plot panel. Each data point is plotted as a dot marker at the center of a rectangle.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XYdXdY- m*4 array of array of double. Contains the x,y coordinates of the m boxes' center and the boxes width and heigth (m lines, 4 rows).- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addBoxPlot
-
addHistogramPlot
Adds a histogram plot to the current plot panel. Each data point is as vertical bar which width can be set.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)XY- m*2 array of array of double. Contains the x coordinate and the heigth of each bar (m lines, 2 rows).dX- Array of double. Contains the width each bar (m lines).- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addHistogramPlot
-
addHistogramPlot
-
addHistogramPlot
Adds a histogram plot to the current plot panel. Each data point is as vertical bar which width can be set.- Parameters:
name- Name for the plot, which will be used in the legend. (String)XYdX- m*3 array of array of double. Contains the x coordinate, the heigth of each bar and the width of each bar (m lines, 3 rows).- Returns:
- the index of the plot in the panel (int).
- See Also:
-
addHistogramPlot
Adds a plot of the statistical repartition of a sample, as a histogram.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)sample- Array of double containing the data which statistics will be plotted.n- Bin number for the statistics (int).- Returns:
- the index of the plot in the panel (int).
-
addHistogramPlot
-
addHistogramPlotOJ
public int addHistogramPlotOJ(String name, double[] X, int n, PlugInContext context, Layer layer, String attrName) [sstein] method for OJUMP- Parameters:
name- name of the plotX- data as a double arrayn- number of classescontext- the PlugInContextlayer- the LayerattrName- name of the attribute to plot
-
addHistogramPlot
Adds a plot of the statistical repartition of a sample, as a histogram. The bins' limits can be set.- Parameters:
name- Name for the plot, which will be used in the legend. (String)color- Plot color. (Color)sample- Array of double containing the data which statistics will be plotted.bounds- Specify the limits for the bins' boundaries.- Returns:
- the index of the plot in the panel (int).
-
addHistogramPlot
-
addHistogramPlot
-
addHistogramPlot
-
addCloudPlot
-
addCloudPlot
-
addPlot
-
getYData
Gets an array with data from Y. In the case of Histogram getYData method it returns the absolute frequency per classes- Returns:
- array Object[]
-
getYData_RelativeFrequency
returns the relative frequancy of Y data- Returns:
- array Object[]
-
getYData_CumulativeFrequency
returns the cumulative frequancy of Y data- Returns:
- array Object[]
-
getXData
Gets an array with data from X. In the case of Histogram getYData method returns the media value of the range fro each interval (for instance: 50 (interval between 0-100), 150 (interval between 100-200) etc)- Returns:
- array Object[]
-
getXData_limits
gets the limit values of each interval of X data. maxvalue true= the upper value, maxvalue false= the lower value- Parameters:
maxvalue- whether the method return max values (true) or min values (false)- Returns:
- max or min values of each class
-