public class SimplePlot extends PlotFrame
For example, a simple plot of an array float[] f can be displayed with
SimplePlot.asSequence(f);
Likewise, a simple plot of an array float[][] f can be displayed with
SimplePlot.asPixels(f);
The plots in these examples use default parameters and cannot be
customized easily. More complex plots can be constructed as in this
example:
SimplePlot plot = new SimplePlot();
plot.addGrid("H-.V-.");
PointsView pv = plot.addPoints(f);
pv.setStyle("r-o");
plot.setTitle("A plot of an array");
plot.setVLabel("array value");
plot.setHLabel("array index");
Modifier and Type | Class and Description |
---|---|
static class |
SimplePlot.Origin
The origin can be either at the upper-left or lower-left of the plot.
|
PlotFrame.Split
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
SimplePlot()
Constructs a simple plot with default lower-left origin.
|
SimplePlot(SimplePlot.Origin origin)
Constructs a simple plot with specified origin.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(TiledView tv)
Adds the specified tiled view to this plot's panel.
|
ColorBar |
addColorBar()
Adds the color bar with no label.
|
ColorBar |
addColorBar(ColorMapped cm)
Adds the color bar for the specified color mapped object.
|
ColorBar |
addColorBar(ColorMapped cm,
java.lang.String label)
Adds the color bar for the specified color mapped object and label.
|
ColorBar |
addColorBar(java.lang.String label)
Adds the color bar with specified label.
|
ContoursView |
addContours(double[][] f)
Adds a contours view of the specified sampled function f(x1,x2).
|
ContoursView |
addContours(float[][] f)
Adds a contours view of the specified sample function f(x1,x2).
|
ContoursView |
addContours(Sampling s1,
Sampling s2,
double[][] f)
Adds a contours view of the specified sampled function f(x1,x2).
|
ContoursView |
addContours(Sampling s1,
Sampling s2,
float[][] f)
Adds a contours view of the specified sampled function f(x1,x2).
|
GridView |
addGrid()
Adds a grid view.
|
GridView |
addGrid(java.lang.String parameters)
Adds a grid view with specified parameters string.
|
PixelsView |
addPixels(double[][] f)
Adds a pixels view of the specified sampled function f(x1,x2).
|
PixelsView |
addPixels(float[][] f)
Adds a pixels view of the specified sampled function f(x1,x2).
|
PixelsView |
addPixels(Sampling s1,
Sampling s2,
double[][] f)
Adds a pixels view of the specified sampled function f(x1,x2).
|
PixelsView |
addPixels(Sampling s1,
Sampling s2,
float[][] f)
Adds a pixels view of the specified sampled function f(x1,x2).
|
PointsView |
addPoints(double[] f)
Adds a points view of specified values f(x).
|
PointsView |
addPoints(double[] x,
double[] y)
Adds a points view of specified values (x,y).
|
PointsView |
addPoints(float[] f)
Adds a points view of specified values f(x).
|
PointsView |
addPoints(float[] x,
float[] y)
Adds a points view of specified values (x,y).
|
PointsView |
addPoints(Sampling s,
double[] f)
Adds a points view of a sampled function f(x).
|
PointsView |
addPoints(Sampling s,
float[] f)
Adds a points view of a sampled function f(x).
|
SequenceView |
addSequence(double[] f)
Adds a sequence view with specified values f(x).
|
SequenceView |
addSequence(float[] f)
Adds a sequence view with specified values f(x).
|
SequenceView |
addSequence(Sampling s,
double[] f)
Adds a sequence view with specified sampling and values f(x).
|
SequenceView |
addSequence(Sampling s,
float[] f)
Adds a sequence view with specified sampling and values f(x).
|
void |
addTitle(java.lang.String title)
Adds the plot title.
|
static SimplePlot |
asContours(float[][] f)
Returns a new plot with a contours view of a sampled function f(x1,x2).
|
static SimplePlot |
asPixels(double[][] f)
Returns a new plot with a pixels view of a sampled function f(x1,x2).
|
static SimplePlot |
asPixels(float[][] f)
Returns a new plot with a pixels view of a sampled function f(x1,x2).
|
static SimplePlot |
asPixels(Sampling s1,
Sampling s2,
double[][] f)
Returns a new plot with a pixels view of a sampled function f(x1,x2).
|
static SimplePlot |
asPixels(Sampling s1,
Sampling s2,
float[][] f)
Returns a new plot with a pixels view of a sampled function f(x1,x2).
|
static SimplePlot |
asPoints(double[] f)
Returns a new plot with a points view of specified values f(x).
|
static SimplePlot |
asPoints(double[] x,
double[] y)
Returns a new plot with a points view of specified values (x,y).
|
static SimplePlot |
asPoints(float[] f)
Returns a new plot with a points view of specified values f(x).
|
static SimplePlot |
asPoints(float[] x,
float[] y)
Returns a new plot with a points view of specified values (x,y).
|
static SimplePlot |
asPoints(Sampling s,
double[] f)
Returns a new plot with a points view of a sampled function f(x).
|
static SimplePlot |
asPoints(Sampling s,
float[] f)
Returns a new plot with a points view of a sampled function f(x).
|
static SimplePlot |
asSequence(double[] f)
Returns a new plot with a sequence view of specified values f(x).
|
static SimplePlot |
asSequence(float[] f)
Returns a new plot with a sequence view of specified values f(x).
|
static SimplePlot |
asSequence(Sampling s,
double[] f)
Returns a new plot with a sequence view of a sampled function f(x).
|
static SimplePlot |
asSequence(Sampling s,
float[] f)
Returns a new plot with a sequence view of a sampled function f(x).
|
PlotPanel |
getPlotPanel()
Gets the plot panel for this plot.
|
boolean |
remove(TiledView tv)
Removes the specified tiled view from this plot's panel.
|
void |
removeTitle()
Removes the plot title.
|
void |
setHFormat(java.lang.String format)
Sets the format for tic labels in the horizontal axis.
|
void |
setHInterval(double interval)
Sets the tic interval for the horizontal axis.
|
void |
setHLabel(java.lang.String label)
Sets the label for the horizontal axis.
|
void |
setHLimits(double hmin,
double hmax)
Sets limits for the horizontal axis.
|
void |
setHLimitsDefault()
Sets default limits for the horizontal axis.
|
void |
setLimits(double hmin,
double vmin,
double hmax,
double vmax)
Sets limits for the both horizontal and vertical axes.
|
void |
setLimitsDefault()
Sets default limits for horizontal and vertical axes.
|
void |
setTitle(java.lang.String title)
Sets the plot title.
|
void |
setVFormat(java.lang.String format)
Sets the format for tic labels in the vertical axis.
|
void |
setVInterval(double interval)
Sets the tic interval for the vertical axis.
|
void |
setVLabel(java.lang.String label)
Sets the label for the vertical axis.
|
void |
setVLimits(double vmin,
double vmax)
Sets limits for the vertical axis.
|
void |
setVLimitsDefault()
Sets default limits for the vertical axis.
|
void |
setVRotated(boolean rotated)
Sets the rotation of tic labels in the vertical axis.
|
getModeManager, getMouseTrackMode, getPlotPanelBottomRight, getPlotPanelTopLeft, getSplitPane, getTileZoomMode, paintToPng, setBackground, setFont, setFontSize, setFontSizeForPrint, setFontSizeForSlide, setFontSizeForSlide, setForeground
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public SimplePlot()
public SimplePlot(SimplePlot.Origin origin)
origin
- the plot origin.public static SimplePlot asPoints(float[] f)
f
- array of sampled function values f(x).public static SimplePlot asPoints(Sampling s, float[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public static SimplePlot asPoints(float[] x, float[] y)
x
- array of x coordinates.y
- array of y coordinates.public static SimplePlot asSequence(float[] f)
f
- array of sampled function values f(x).public static SimplePlot asSequence(Sampling s, float[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public static SimplePlot asPixels(float[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public static SimplePlot asPixels(Sampling s1, Sampling s2, float[][] f)
s1
- the sampling of the x1 coordinate.s2
- the sampling of the x2 coordinate.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public static SimplePlot asPoints(double[] f)
f
- array of sampled function values f(x).public static SimplePlot asPoints(Sampling s, double[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public static SimplePlot asPoints(double[] x, double[] y)
x
- array of x coordinates.y
- array of y coordinates.public static SimplePlot asSequence(double[] f)
f
- array of sampled function values f(x).public static SimplePlot asSequence(Sampling s, double[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public static SimplePlot asPixels(double[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public static SimplePlot asPixels(Sampling s1, Sampling s2, double[][] f)
s1
- the sampling of the x1 coordinate.s2
- the sampling of the x2 coordinate.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public static SimplePlot asContours(float[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public GridView addGrid()
public GridView addGrid(java.lang.String parameters)
GridView.setParameters(String)
.parameters
- the parameters string.public PointsView addPoints(float[] f)
f
- array of sampled function values f(x).public PointsView addPoints(Sampling s, float[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public PointsView addPoints(float[] x, float[] y)
x
- array of x coordinates.y
- array of y coordinates.public PointsView addPoints(double[] f)
f
- array of sampled function values f(x).public PointsView addPoints(Sampling s, double[] f)
s
- the sampling of the x coordinate.f
- array of sampled function values f(x).public PointsView addPoints(double[] x, double[] y)
x
- array of x coordinates.y
- array of y coordinates.public SequenceView addSequence(float[] f)
f
- array of sampled function values f(x).public SequenceView addSequence(Sampling s, float[] f)
s
- the sampling of the variable x.f
- array of sampled function values f(x).public SequenceView addSequence(double[] f)
f
- array of sampled function values f(x).public SequenceView addSequence(Sampling s, double[] f)
s
- the sampling of the variable x.f
- array of sampled function values f(x).public PixelsView addPixels(float[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public PixelsView addPixels(Sampling s1, Sampling s2, float[][] f)
s1
- the sampling of the variable x1; must be uniform.s2
- the sampling of the variable x2; must be uniform.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public PixelsView addPixels(double[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public PixelsView addPixels(Sampling s1, Sampling s2, double[][] f)
s1
- the sampling of the variable x1; must be uniform.s2
- the sampling of the variable x2; must be uniform.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public ContoursView addContours(float[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n2 = f[0].length and n2 = f.length.public ContoursView addContours(Sampling s1, Sampling s2, float[][] f)
s1
- the sampling of the variable x1; must be uniform.s2
- the sampling of the variable x2; must be uniform.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public ContoursView addContours(double[][] f)
f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public ContoursView addContours(Sampling s1, Sampling s2, double[][] f)
s1
- the sampling of the variable x1; must be uniform.s2
- the sampling of the variable x2; must be uniform.f
- array[n2][n1] of sampled function values f(x1,x2), where
n1 = f[0].length and n2 = f.length.public ColorBar addColorBar()
public ColorBar addColorBar(java.lang.String label)
label
- the label; null, if none.public ColorBar addColorBar(ColorMapped cm)
cm
- the color mapped object.public ColorBar addColorBar(ColorMapped cm, java.lang.String label)
cm
- the color mapped object.label
- the label; null, if none.public boolean add(TiledView tv)
tv
- the tiled view.public boolean remove(TiledView tv)
tv
- the tiled view.public void addTitle(java.lang.String title)
setTitle(String)
.
The title font is 1.5 times larger than the font of this plot.title
- the title; null, if none.public void setTitle(java.lang.String title)
addTitle(String)
.setTitle
in class java.awt.Frame
title
- the title; null, for no title.public void removeTitle()
setTitle(String)
with a null title.public void setLimits(double hmin, double vmin, double hmax, double vmax)
hmin
- the minimum value.vmin
- the minimum value.hmax
- the maximum value.vmax
- the maximum value.public void setHLimits(double hmin, double hmax)
hmin
- the minimum value.hmax
- the maximum value.public void setVLimits(double vmin, double vmax)
vmin
- the minimum value.vmax
- the maximum value.public void setLimitsDefault()
public void setHLimitsDefault()
public void setVLimitsDefault()
public void setHInterval(double interval)
interval
- the major labeled tic interval.public void setVInterval(double interval)
interval
- the major labeled tic interval.public void setHLabel(java.lang.String label)
label
- the label.public void setVLabel(java.lang.String label)
label
- the label.public void setHFormat(java.lang.String format)
format
- the format.public void setVFormat(java.lang.String format)
format
- the format.public void setVRotated(boolean rotated)
rotated
- true if rotated; false, otherwise.public PlotPanel getPlotPanel()
getPlotPanel
in class PlotFrame