public class GPlot extends java.lang.Object implements PConstants
Modifier and Type | Field and Description |
---|---|
static int |
ALTMOD |
static int |
BOTH |
static int |
CTRLMOD |
static int |
HORIZONTAL |
static float |
LOG10 |
static java.lang.String |
MAINLAYERID |
static int |
METAMOD |
static int |
NONE |
static int |
SHIFTMOD |
static int |
VERTICAL |
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
GPlot(PApplet parent)
GPlot constructor
|
GPlot(PApplet parent,
float xPos,
float yPos)
GPlot constructor
|
GPlot(PApplet parent,
float xPos,
float yPos,
float plotWidth,
float plotHeight)
GPlot constructor
|
Modifier and Type | Method and Description |
---|---|
void |
activateCentering()
Activates the option to center the plot with the mouse using the LEFT button
|
void |
activateCentering(int button)
Activates the option to center the plot with the mouse using the specified button
|
void |
activateCentering(int button,
int keyModifier)
Activates the option to center the plot with the mouse using the specified button and the specified key modifier
|
void |
activatePanning()
Activates the option to pan the plot with the mouse using the LEFT button
|
void |
activatePanning(int button)
Activates the option to pan the plot with the mouse using the specified button
|
void |
activatePanning(int button,
int keyModifier)
Activates the option to pan the plot with the mouse using the specified button and the specified key modifier
|
void |
activatePointLabels()
Activates the option to draw the labels of the points with the mouse using the LEFT button
|
void |
activatePointLabels(int button)
Activates the option to draw the labels of the points with the mouse using the specified button
|
void |
activatePointLabels(int button,
int keyModifier)
Activates the option to draw the labels of the points with the mouse using the specified button and the specified
key modifier
|
void |
activateReset()
Activates the option to return to the value of the axes limits previous to any mouse interaction, using the RIGHT
button
|
void |
activateReset(int button)
Activates the option to return to the value of the axes limits previous to any mouse interaction, using the
specified button
|
void |
activateReset(int button,
int keyModifier)
Activates the option to return to the value of the axes limits previous to any mouse interaction, using the
specified button and the specified key modifier
|
void |
activateZooming()
Activates the option to zoom with the mouse using the LEFT and RIGHT buttons
|
void |
activateZooming(float factor)
Activates the option to zoom with the mouse using the LEFT and RIGHT buttons
|
void |
activateZooming(float factor,
int increaseButton,
int decreaseButton)
Activates the option to zoom with the mouse using the specified buttons
|
void |
activateZooming(float factor,
int increaseButton,
int decreaseButton,
int increaseKeyModifier,
int decreaseKeyModifier)
Activates the option to zoom with the mouse using the specified buttons and the specified key modifiers
|
void |
addLayer(GLayer newLayer)
Adds a layer to the plot
|
void |
addLayer(java.lang.String id,
GPointsArray points)
Adds a new layer to the plot
|
void |
addPoint(float x,
float y)
Adds a new point to the main layer points
|
void |
addPoint(float x,
float y,
java.lang.String label)
Adds a new point to the main layer points
|
void |
addPoint(float x,
float y,
java.lang.String label,
java.lang.String layerId)
Adds a new point to the specified layer points
|
void |
addPoint(GPoint newPoint)
Adds a new point to the main layer points
|
void |
addPoint(GPoint newPoint,
java.lang.String layerId)
Adds a new point to the specified layer points
|
void |
addPoint(int index,
float x,
float y)
Adds a new point to the main layer points
|
void |
addPoint(int index,
float x,
float y,
java.lang.String label)
Adds a new point to the main layer points
|
void |
addPoint(int index,
float x,
float y,
java.lang.String label,
java.lang.String layerId)
Adds a new point to the specified layer points
|
void |
addPoint(int index,
GPoint newPoint)
Adds a new point to the main layer points
|
void |
addPoint(int index,
GPoint newPoint,
java.lang.String layerId)
Adds a new point to the specified layer points
|
void |
addPointAt(float xScreen,
float yScreen)
Adds a point to the main layer at a given screen position
|
void |
addPointAt(float xScreen,
float yScreen,
java.lang.String layerId)
Adds a point to the specified layer at a given screen position
|
void |
addPoints(GPointsArray newPoints)
Adds new points to the main layer points
|
void |
addPoints(GPointsArray newPoints,
java.lang.String layerId)
Adds new points to the specified layer points
|
void |
align(float[] value,
float xScreen,
float yScreen)
Shifts the plot coordinates in a way that after that the given plot value will be at the specified screen
position
|
void |
align(float xValue,
float yValue,
float xScreen,
float yScreen)
Shifts the plot coordinates in a way that after that the given plot value will be at the specified screen
position
|
void |
beginDraw()
Prepares the environment to start drawing the different plot components (points, axes, title, etc).
|
float[] |
calculatePointsXLim(GPointsArray points)
Calculates the x limits of a given set of points, considering the plot properties (axis log scale, if the other
axis limits are fixed, etc)
|
float[] |
calculatePointsYLim(GPointsArray points)
Calculates the y limits of a given set of points, considering the plot properties (axis log scale, if the other
axis limits are fixed, etc)
|
void |
center(float xScreen,
float yScreen)
Centers the plot coordinates at the plot value that is at the specified screen position
|
void |
centerAndZoom(float factor,
float xValue,
float yValue)
Centers the plot coordinates on the specified (x, y) point and zooms the limits range by a given factor
|
void |
deactivateCentering()
Deactivates the option to center the plot with the mouse
|
void |
deactivatePanning()
Deactivates the option to pan the plot with the mouse
|
void |
deactivatePointLabels()
Deactivates the option to draw the labels of the points with the mouse
|
void |
deactivateReset()
Deactivates the option to return to the value of the axes limits previous to any mouse interaction using the
mouse
|
void |
deactivateZooming()
Deactivates the option to zoom with the mouse
|
void |
defaultDraw()
Draws the plot on the screen with default parameters
|
void |
drawAnnotation(java.lang.String text,
float x,
float y,
int horAlign,
int verAlign)
Draws an annotation at a given plot value
|
void |
drawBackground()
Draws the plot background.
|
void |
drawBox()
Draws the box area.
|
void |
drawFilledContours(int contourType,
float referenceValue)
Draws filled contours connecting the points from all layers in the plot and a reference value
|
void |
drawGridLines(int gridType)
Draws lines connecting the horizontal and vertical axis ticks
|
void |
drawHistograms()
Draws the histograms of all layers
|
void |
drawHorizontalLine(float value)
Draws an horizontal line in the plot
|
void |
drawHorizontalLine(float value,
int lineColor,
float lineWidth)
Draws an horizontal line in the plot
|
void |
drawLabel(GPoint point)
Draws the label of a given point
|
void |
drawLabels()
Draws the labels of the points in the layers that are close to the mouse position.
|
void |
drawLabelsAt(float xScreen,
float yScreen)
Draws the labels of the points in the layers that are close to a given screen position
|
void |
drawLegend(java.lang.String[] text,
float[] xRelativePos,
float[] yRelativePos)
Draws a legend at the specified relative position
|
void |
drawLine(float slope,
float yCut)
Draws a line in the plot, defined by the slope and the cut in the y axis
|
void |
drawLine(float slope,
float yCut,
int lineColor,
float lineWidth)
Draws a line in the plot, defined by the slope and the cut in the y axis
|
void |
drawLine(GPoint point1,
GPoint point2)
Draws a line in the plot, defined by two extreme points
|
void |
drawLine(GPoint point1,
GPoint point2,
int lineColor,
float lineWidth)
Draws a line in the plot, defined by two extreme points
|
void |
drawLines()
Draws lines connecting the points from all layers in the plot
|
void |
drawPoint(GPoint point)
Draws a point in the plot
|
void |
drawPoint(GPoint point,
int pointColor,
float pointSize)
Draws a point in the plot
|
void |
drawPoint(GPoint point,
PImage pointImg)
Draws a point in the plot
|
void |
drawPoint(GPoint point,
PShape pointShape)
Draws a point in the plot
|
void |
drawPoint(GPoint point,
PShape pointShape,
int pointColor)
Draws a point in the plot
|
void |
drawPoints()
Draws the points from all layers in the plot
|
void |
drawPoints(PImage pointImg)
Draws the points from all layers in the plot
|
void |
drawPoints(PShape pointShape)
Draws the points from all layers in the plot
|
void |
drawPolygon(GPointsArray polygonPoints,
int polygonColor)
Draws a polygon defined by a set of points
|
void |
drawRightAxis()
Draws the right axis
|
void |
drawTitle()
Draws the title
|
void |
drawTopAxis()
Draws the top axis
|
void |
drawVerticalLine(float value)
Draws a vertical line in the plot
|
void |
drawVerticalLine(float value,
int lineColor,
float lineWidth)
Draws a vertical line in the plot
|
void |
drawXAxis()
Draws the x axis
|
void |
drawYAxis()
Draws the y axis
|
void |
endDraw()
Returns the sketch to the state that it had before calling beginDraw()
|
float[] |
getDim()
Returns the box dimensions
|
boolean |
getFixedXLim()
Returns true if the horizontal axes limits are fixed
|
boolean |
getFixedYLim()
Returns true if the vertical axes limits are fixed
|
GHistogram |
getHistogram()
Returns the histogram of the main layer
|
GHistogram |
getHistogram(java.lang.String layerId)
Returns the histogram of the specified layer
|
boolean |
getInvertedXScale()
Returns true if the horizontal axes limits are inverted
|
boolean |
getInvertedYScale()
Returns true if the vertical axes limits are inverted
|
GLayer |
getLayer(java.lang.String id)
Returns a layer with an specific id
|
GLayer |
getMainLayer()
Returns the plot main layer
|
float[] |
getMar()
Returns the plot margins
|
float[] |
getOuterDim()
Returns the plot outer dimensions
|
float[] |
getPlotPosAt(float xScreen,
float yScreen)
Calculates the position of a point in the screen, relative to the plot reference system
|
GPoint |
getPointAt(float xScreen,
float yScreen)
Returns the closest point in the main layer to a given screen position
|
GPoint |
getPointAt(float xScreen,
float yScreen,
java.lang.String layerId)
Returns the closest point in the specified layer to a given screen position
|
GPointsArray |
getPoints()
Returns a copy of the points of the main layer
|
GPointsArray |
getPoints(java.lang.String layerId)
Returns a copy of the points of the specified layer
|
GPointsArray |
getPointsRef()
Returns the points of the main layer
|
GPointsArray |
getPointsRef(java.lang.String layerId)
Returns the points of the specified layer
|
float[] |
getPos()
Returns the plot position
|
float[] |
getRelativePlotPosAt(float xScreen,
float yScreen)
Returns the relative plot position of a given screen position
|
GAxis |
getRightAxis()
Returns the plot right axis
|
float[] |
getScreenPosAtValue(float xValue,
float yValue)
Calculates the position of a given (x, y) point in the parent Processing applet screen
|
GTitle |
getTitle()
Returns the plot title
|
GAxis |
getTopAxis()
Returns the plot top axis
|
float[] |
getValueAt(float xScreen,
float yScreen)
Returns the plot value at a given screen position
|
GAxis |
getXAxis()
Returns the plot x axis
|
float[] |
getXLim()
Returns the limits of the horizontal axes
|
boolean |
getXLog()
Returns true if the horizontal axes scale is logarithmic
|
GAxis |
getYAxis()
Returns the plot y axis
|
float[] |
getYLim()
Returns the limits of the vertical axes
|
boolean |
getYLog()
Returns true if the vertical axes scale is logarithmic
|
void |
invertXScale()
Inverts the horizontal axes scale
|
void |
invertYScale()
Inverts the vertical axes scale
|
boolean |
isOverBox(float xScreen,
float yScreen)
Indicates if a given screen position is inside the plot box area
|
boolean |
isOverPlot(float xScreen,
float yScreen)
Indicates if a given screen position is inside the main plot area
|
void |
mouseEvent(MouseEvent event)
Mouse events (zooming, centering, panning, labeling)
|
void |
moveHorizontalAxesLim(float delta)
Moves the horizontal axes limits by a given amount specified in pixel units
|
void |
moveVerticalAxesLim(float delta)
Moves the vertical axes limits by a given amount specified in pixel units
|
void |
removeLayer(java.lang.String id)
Removes an exiting layer from the plot, provided it is not the plot main layer
|
void |
removePoint(int index)
Removes one of the main layer points
|
void |
removePoint(int index,
java.lang.String layerId)
Removes one of the specified layer points
|
void |
removePointAt(float xScreen,
float yScreen)
Removes a point from the main layer at a given screen position
|
void |
removePointAt(float xScreen,
float yScreen,
java.lang.String layerId)
Removes a point from the specified layer at a given screen position
|
void |
setAllFontProperties(java.lang.String fontName,
int fontColor,
int fontSize)
Sets the properties of the font that will be used in all plot elements (layer, axes, title, histogram)
|
void |
setAxesOffset(float offset)
Sets the axis offset for all the axes in the plot
|
void |
setBgColor(int newBgColor)
Sets the plot background color
|
void |
setBoxBgColor(int newBoxBgColor)
Sets the box background color
|
void |
setBoxLineColor(int newBoxLineColor)
Sets the box line color
|
void |
setBoxLineWidth(float newBoxLineWidth)
Sets the box line width
|
void |
setDim(float[] newDim)
Sets the plot box dimensions
|
void |
setDim(float xDim,
float yDim)
Sets the plot box dimensions
|
void |
setDrawHistLabels(boolean drawHistLabels)
Sets if the labels of the histogram in the main layer will be drawn or not
|
void |
setExpandLimFactor(float expandFactor)
Sets the factor that is used to expand the axes limits
|
void |
setFixedXLim(boolean newFixedXLim)
Sets if the horizontal axes limits are fixed or not
|
void |
setFixedYLim(boolean newFixedYLim)
Sets if the vertical axes limits are fixed or not
|
void |
setFontColor(int fontColor)
Sets the color of the font that is used in the main layer
|
void |
setFontName(java.lang.String fontName)
Sets the name of the font that is used in the main layer
|
void |
setFontProperties(java.lang.String fontName,
int fontColor,
int fontSize)
Sets the properties of the font that is used in the main layer
|
void |
setFontSize(int fontSize)
Sets the size of the font that is used in the main layer
|
void |
setGridLineColor(int newGridLineColor)
Sets the grid line color
|
void |
setGridLineWidth(float newGridLineWidth)
Sets the grid line width
|
void |
setHistBasePoint(GPoint basePoint)
Sets the base point for the histogram in the main layer
|
void |
setHistType(int histType)
Sets the histogram type for the histogram in the main layer
|
void |
setHistVisible(boolean visible)
Sets if the histogram in the main layer is visible or not
|
void |
setHorizontalAxesNTicks(int nTicks)
Sets the approximate number of ticks in the horizontal axes.
|
void |
setHorizontalAxesTicks(float[] ticks)
Sets the horizontal axes ticks
|
void |
setHorizontalAxesTicksSeparation(float ticksSeparation)
Sets the separation between the ticks in the horizontal axes
|
void |
setIncludeAllLayersInLim(boolean includeAllLayers)
Sets if all the plot layers should be considered in the axes limits calculation
|
void |
setInvertedXScale(boolean newInvertedXScale)
Sets if the scale of the horizontal axes should be inverted or not
|
void |
setInvertedYScale(boolean newInvertedYScale)
Sets if the scale of the vertical axes should be inverted or not
|
void |
setLabelBgColor(int labelBgColor)
Sets the label background color of the points in the main layer
|
void |
setLabelSeparation(float[] labelSeparation)
Sets the label separation of the points in the main layer
|
void |
setLineColor(int lineColor)
Sets the line color for the main layer
|
void |
setLineWidth(float lineWidth)
Sets the line width for the main layer
|
void |
setLogScale(java.lang.String logType)
Sets if the scale for the horizontal and vertical axes is logarithmic or not
|
void |
setMar(float[] newMar)
Sets the plot margins
|
void |
setMar(float bottomMargin,
float leftMargin,
float topMargin,
float rightMargin)
Sets the plot margins
|
void |
setOuterDim(float[] newOuterDim)
Sets the plot outer dimensions
|
void |
setOuterDim(float xOuterDim,
float yOuterDim)
Sets the plot outer dimensions
|
void |
setPoint(int index,
float x,
float y)
Sets one of the main layer points
|
void |
setPoint(int index,
float x,
float y,
java.lang.String label)
Sets one of the main layer points
|
void |
setPoint(int index,
float x,
float y,
java.lang.String label,
java.lang.String layerId)
Sets one of the specified layer points
|
void |
setPoint(int index,
GPoint newPoint)
Sets one of the main layer points
|
void |
setPoint(int index,
GPoint newPoint,
java.lang.String layerId)
Sets one of the specified layer points
|
void |
setPointColor(int pointColor)
Sets the point color for the main layer
|
void |
setPointColors(int[] pointColors)
Sets the point colors for the main layer
|
void |
setPoints(GPointsArray points)
Sets the points for the main layer
|
void |
setPoints(GPointsArray points,
java.lang.String layerId)
Sets the points for the specified layer
|
void |
setPointSize(float pointSize)
Sets the point size for the main layer
|
void |
setPointSizes(float[] pointSizes)
Sets the point sizes for the main layer
|
void |
setPos(float[] newPos)
Sets the plot position
|
void |
setPos(float x,
float y)
Sets the plot position
|
void |
setTicksLength(float tickLength)
Sets the tick length for all the axes in the plot
|
void |
setTitleText(java.lang.String text)
Set the plot title text
|
void |
setVerticalAxesNTicks(int nTicks)
Sets the approximate number of ticks in the vertical axes.
|
void |
setVerticalAxesTicks(float[] ticks)
Sets the vertical axes ticks
|
void |
setVerticalAxesTicksSeparation(float ticksSeparation)
Sets the separation between the ticks in the vertical axes
|
void |
setXLim(float[] newXLim)
Sets the horizontal axes limits
|
void |
setXLim(float lowerLim,
float upperLim)
Sets the horizontal axes limits
|
void |
setYLim(float[] newYLim)
Sets the vertical axes limits
|
void |
setYLim(float lowerLim,
float upperLim)
Sets the vertical axes limits
|
void |
startHistograms(int histType)
Initializes the histograms in all the plot layers
|
void |
updateLimits()
Calculates and updates the plot x and y limits
|
void |
zoom(float factor)
Zooms the limits range by a given factor
|
void |
zoom(float factor,
float xScreen,
float yScreen)
Zooms the limits range by a given factor keeping the same plot value at the specified screen position
|
public static final java.lang.String MAINLAYERID
public static final int VERTICAL
public static final int HORIZONTAL
public static final int BOTH
public static final int NONE
public static final int ALTMOD
public static final int CTRLMOD
public static final int METAMOD
public static final int SHIFTMOD
public static final float LOG10
public GPlot(PApplet parent, float xPos, float yPos, float plotWidth, float plotHeight)
parent
- the parent Processing appletxPos
- the plot x position on the screenyPos
- the plot y position on the screenplotWidth
- the plot width (x outer dimension)plotHeight
- the plot height (y outer dimension)public GPlot(PApplet parent, float xPos, float yPos)
parent
- the parent Processing appletxPos
- the plot x position on the screenyPos
- the plot y position on the screenpublic GPlot(PApplet parent)
parent
- the parent Processing appletpublic void addLayer(GLayer newLayer)
newLayer
- the layer to addpublic void addLayer(java.lang.String id, GPointsArray points)
id
- the id to use for the new layerpoints
- the points to be included in the layerpublic void removeLayer(java.lang.String id)
id
- the id of the layer to removepublic float[] getPlotPosAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic float[] getScreenPosAtValue(float xValue, float yValue)
xValue
- the x valueyValue
- the y valuepublic GPoint getPointAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic GPoint getPointAt(float xScreen, float yScreen, java.lang.String layerId)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletlayerId
- the layer idpublic void addPointAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void addPointAt(float xScreen, float yScreen, java.lang.String layerId)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletlayerId
- the layer idpublic void removePointAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void removePointAt(float xScreen, float yScreen, java.lang.String layerId)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletlayerId
- the layer idpublic float[] getValueAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic float[] getRelativePlotPosAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic boolean isOverPlot(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic boolean isOverBox(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void updateLimits()
public float[] calculatePointsXLim(GPointsArray points)
points
- the points for which we want to calculate the x limitspublic float[] calculatePointsYLim(GPointsArray points)
points
- the points for which we want to calculate the y limSitspublic void moveHorizontalAxesLim(float delta)
delta
- pixels to movepublic void moveVerticalAxesLim(float delta)
delta
- pixels to movepublic void centerAndZoom(float factor, float xValue, float yValue)
factor
- the plot limits will be zoomed by this factorxValue
- the x plot valueyValue
- the y plot valuepublic void zoom(float factor)
factor
- the plot limits will be zoomed by this factorpublic void zoom(float factor, float xScreen, float yScreen)
factor
- the plot limits will be zoomed by this factorxScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void align(float xValue, float yValue, float xScreen, float yScreen)
xValue
- the x plot valueyValue
- the y plot valuexScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void align(float[] value, float xScreen, float yScreen)
value
- the x and y plot valuesxScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void center(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void startHistograms(int histType)
histType
- the type of histogram to use. It can be GPlot.VERTICAL or GPlot.HORIZONTALpublic void defaultDraw()
public void beginDraw()
public void endDraw()
public void drawBackground()
public void drawBox()
public void drawXAxis()
public void drawTopAxis()
public void drawYAxis()
public void drawRightAxis()
public void drawTitle()
public void drawPoints()
public void drawPoints(PShape pointShape)
pointShape
- the shape that should be used to represent the pointspublic void drawPoints(PImage pointImg)
pointImg
- the image that should be used to represent the pointspublic void drawPoint(GPoint point, int pointColor, float pointSize)
point
- the point to drawpointColor
- color to usepointSize
- point size in pixelspublic void drawPoint(GPoint point)
point
- the point to drawpublic void drawPoint(GPoint point, PShape pointShape)
point
- the point to drawpointShape
- the shape that should be used to represent the pointpublic void drawPoint(GPoint point, PShape pointShape, int pointColor)
point
- the point to drawpointShape
- the shape that should be used to represent the pointspointColor
- color to usepublic void drawPoint(GPoint point, PImage pointImg)
point
- the point to drawpointImg
- the image that should be used to represent the pointpublic void drawLines()
public void drawLine(GPoint point1, GPoint point2, int lineColor, float lineWidth)
point1
- first pointpoint2
- second pointlineColor
- line colorlineWidth
- line widthpublic void drawLine(GPoint point1, GPoint point2)
point1
- first pointpoint2
- second pointpublic void drawLine(float slope, float yCut, int lineColor, float lineWidth)
slope
- the line slopeyCut
- the line y axis cutlineColor
- line colorlineWidth
- line widthpublic void drawLine(float slope, float yCut)
slope
- the line slopeyCut
- the line y axis cutpublic void drawHorizontalLine(float value, int lineColor, float lineWidth)
value
- line horizontal valuelineColor
- line colorlineWidth
- line widthpublic void drawHorizontalLine(float value)
value
- line horizontal valuepublic void drawVerticalLine(float value, int lineColor, float lineWidth)
value
- line vertical valuelineColor
- line colorlineWidth
- line widthpublic void drawVerticalLine(float value)
value
- line vertical valuepublic void drawFilledContours(int contourType, float referenceValue)
contourType
- the type of contours to use. It can be GPlot.VERTICAL or GPlot.HORIZONTALreferenceValue
- the reference value to use to close the contourpublic void drawLabel(GPoint point)
point
- the pointpublic void drawLabelsAt(float xScreen, float yScreen)
xScreen
- x screen position in the parent Processing appletyScreen
- y screen position in the parent Processing appletpublic void drawLabels()
public void drawGridLines(int gridType)
gridType
- the type of grid to use. It could be GPlot.HORIZONTAL, GPlot.VERTICAL or GPlot.BOTHpublic void drawHistograms()
public void drawPolygon(GPointsArray polygonPoints, int polygonColor)
polygonPoints
- the points that define the polygonpolygonColor
- the color to use to draw the polygon (contour and background)public void drawAnnotation(java.lang.String text, float x, float y, int horAlign, int verAlign)
text
- the annotation textx
- x plot valuey
- y plot valuehorAlign
- text horizontal alignment. It can be RIGHT, LEFT or CENTERverAlign
- text vertical alignment. It can be TOP, BOTTOM or CENTERpublic void drawLegend(java.lang.String[] text, float[] xRelativePos, float[] yRelativePos)
text
- the text to use for each layer in the plotxRelativePos
- the plot x relative position for each layer in the plotyRelativePos
- the plot y relative position for each layer in the plotpublic void setPos(float x, float y)
x
- the new plot x position on the screeny
- the new plot y position on the screenpublic void setPos(float[] newPos)
newPos
- the new plot (x, y) positionpublic void setOuterDim(float xOuterDim, float yOuterDim)
xOuterDim
- the new plot x outer dimensionyOuterDim
- the new plot y outer dimensionpublic void setOuterDim(float[] newOuterDim)
newOuterDim
- the new plot outer dimensionspublic void setMar(float bottomMargin, float leftMargin, float topMargin, float rightMargin)
bottomMargin
- the new plot bottom marginleftMargin
- the new plot left margintopMargin
- the new plot top marginrightMargin
- the new plot right marginpublic void setMar(float[] newMar)
newMar
- the new plot marginspublic void setDim(float xDim, float yDim)
xDim
- the new plot box x dimensionyDim
- the new plot box y dimensionpublic void setDim(float[] newDim)
newDim
- the new plot box dimensionspublic void setXLim(float lowerLim, float upperLim)
lowerLim
- the new axes lower limitupperLim
- the new axes upper limitpublic void setXLim(float[] newXLim)
newXLim
- the new horizontal axes limitspublic void setYLim(float lowerLim, float upperLim)
lowerLim
- the new axes lower limitupperLim
- the new axes upper limitpublic void setYLim(float[] newYLim)
newYLim
- the new vertical axes limitspublic void setFixedXLim(boolean newFixedXLim)
newFixedXLim
- the fixed condition for the horizontal axespublic void setFixedYLim(boolean newFixedYLim)
newFixedYLim
- the fixed condition for the vertical axespublic void setLogScale(java.lang.String logType)
logType
- the type of scale for the horizontal and vertical axespublic void setInvertedXScale(boolean newInvertedXScale)
newInvertedXScale
- true if the horizontal scale should be invertedpublic void invertXScale()
public void setInvertedYScale(boolean newInvertedYScale)
newInvertedYScale
- true if the vertical scale should be invertedpublic void invertYScale()
public void setIncludeAllLayersInLim(boolean includeAllLayers)
includeAllLayers
- true if all layers should be considered and not only the main layerpublic void setExpandLimFactor(float expandFactor)
expandFactor
- the new expansion factorpublic void setBgColor(int newBgColor)
newBgColor
- the new plot background colorpublic void setBoxBgColor(int newBoxBgColor)
newBoxBgColor
- the new box background colorpublic void setBoxLineColor(int newBoxLineColor)
newBoxLineColor
- the new box background colorpublic void setBoxLineWidth(float newBoxLineWidth)
newBoxLineWidth
- the new box line widthpublic void setGridLineColor(int newGridLineColor)
newGridLineColor
- the new grid line colorpublic void setGridLineWidth(float newGridLineWidth)
newGridLineWidth
- the new grid line widthpublic void setPoints(GPointsArray points)
points
- the new points for the main layerpublic void setPoints(GPointsArray points, java.lang.String layerId)
points
- the new points for the main layerlayerId
- the layer idpublic void setPoint(int index, float x, float y, java.lang.String label)
index
- the point positionx
- the point new x coordinatey
- the point new y coordinatelabel
- the point new labelpublic void setPoint(int index, float x, float y, java.lang.String label, java.lang.String layerId)
index
- the point positionx
- the point new x coordinatey
- the point new y coordinatelabel
- the point new labellayerId
- the layer idpublic void setPoint(int index, float x, float y)
index
- the point positionx
- the point new x coordinatey
- the point new y coordinatepublic void setPoint(int index, GPoint newPoint)
index
- the point positionnewPoint
- the new pointpublic void setPoint(int index, GPoint newPoint, java.lang.String layerId)
index
- the point positionnewPoint
- the new pointlayerId
- the layer idpublic void addPoint(float x, float y, java.lang.String label)
x
- the new point x coordinatey
- the new point y coordinatelabel
- the new point labelpublic void addPoint(float x, float y, java.lang.String label, java.lang.String layerId)
x
- the new point x coordinatey
- the new point y coordinatelabel
- the new point labellayerId
- the layer idpublic void addPoint(float x, float y)
x
- the new point x coordinatey
- the new point y coordinatepublic void addPoint(GPoint newPoint)
newPoint
- the point to addpublic void addPoint(GPoint newPoint, java.lang.String layerId)
newPoint
- the point to addlayerId
- the layer idpublic void addPoint(int index, float x, float y, java.lang.String label)
index
- the position to add the pointx
- the new point x coordinatey
- the new point y coordinatelabel
- the new point labelpublic void addPoint(int index, float x, float y, java.lang.String label, java.lang.String layerId)
index
- the position to add the pointx
- the new point x coordinatey
- the new point y coordinatelabel
- the new point labellayerId
- the layer idpublic void addPoint(int index, float x, float y)
index
- the position to add the pointx
- the new point x coordinatey
- the new point y coordinatepublic void addPoint(int index, GPoint newPoint)
index
- the position to add the pointnewPoint
- the point to addpublic void addPoint(int index, GPoint newPoint, java.lang.String layerId)
index
- the position to add the pointnewPoint
- the point to addlayerId
- the layer idpublic void addPoints(GPointsArray newPoints)
newPoints
- the points to addpublic void addPoints(GPointsArray newPoints, java.lang.String layerId)
newPoints
- the points to addlayerId
- the layer idpublic void removePoint(int index)
index
- the point positionpublic void removePoint(int index, java.lang.String layerId)
index
- the point positionlayerId
- the layer idpublic void setPointColors(int[] pointColors)
pointColors
- the point colors for the main layerpublic void setPointColor(int pointColor)
pointColor
- the point color for the main layerpublic void setPointSizes(float[] pointSizes)
pointSizes
- the point sizes for the main layerpublic void setPointSize(float pointSize)
pointSize
- the point sizes for the main layerpublic void setLineColor(int lineColor)
lineColor
- the line color for the main layerpublic void setLineWidth(float lineWidth)
lineWidth
- the line with for the main layerpublic void setHistBasePoint(GPoint basePoint)
basePoint
- the base point for the histogram in the main layerpublic void setHistType(int histType)
histType
- the histogram type for the histogram in the main layer. It can be GPlot.HORIZONTAL or
GPlot.VERTICALpublic void setHistVisible(boolean visible)
visible
- if true, the histogram is visiblepublic void setDrawHistLabels(boolean drawHistLabels)
drawHistLabels
- if true, the histogram labels will be drawnpublic void setLabelBgColor(int labelBgColor)
labelBgColor
- the label background color of the points in the main layerpublic void setLabelSeparation(float[] labelSeparation)
labelSeparation
- the label separation of the points in the main layerpublic void setTitleText(java.lang.String text)
text
- the plot title textpublic void setAxesOffset(float offset)
offset
- the new axis offsetpublic void setTicksLength(float tickLength)
tickLength
- the new tick lengthpublic void setHorizontalAxesNTicks(int nTicks)
nTicks
- the new approximate number of ticks in the horizontal axespublic void setHorizontalAxesTicksSeparation(float ticksSeparation)
ticksSeparation
- the new ticks separation in the horizontal axespublic void setHorizontalAxesTicks(float[] ticks)
ticks
- the new horizontal axes tickspublic void setVerticalAxesNTicks(int nTicks)
nTicks
- the new approximate number of ticks in the vertical axespublic void setVerticalAxesTicksSeparation(float ticksSeparation)
ticksSeparation
- the new ticks separation in the vertical axespublic void setVerticalAxesTicks(float[] ticks)
ticks
- the new vertical axes tickspublic void setFontName(java.lang.String fontName)
fontName
- the name of the font that will be used in the main layerpublic void setFontColor(int fontColor)
fontColor
- the color of the font that will be used in the main layerpublic void setFontSize(int fontSize)
fontSize
- the size of the font that will be used in the main layerpublic void setFontProperties(java.lang.String fontName, int fontColor, int fontSize)
fontName
- the name of the font that will be used in the main layerfontColor
- the color of the font that will be used in the main layerfontSize
- the size of the font that will be used in the main layerpublic void setAllFontProperties(java.lang.String fontName, int fontColor, int fontSize)
fontName
- the name of the font that will be used in all plot elementsfontColor
- the color of the font that will be used in all plot elementsfontSize
- the size of the font that will be used in all plot elementspublic float[] getPos()
public float[] getOuterDim()
public float[] getMar()
public float[] getDim()
public float[] getXLim()
public float[] getYLim()
public boolean getFixedXLim()
public boolean getFixedYLim()
public boolean getXLog()
public boolean getYLog()
public boolean getInvertedXScale()
public boolean getInvertedYScale()
public GLayer getMainLayer()
public GLayer getLayer(java.lang.String id)
id
- the id of the layer to returnpublic GAxis getXAxis()
public GAxis getTopAxis()
public GAxis getYAxis()
public GAxis getRightAxis()
public GTitle getTitle()
public GPointsArray getPoints()
public GPointsArray getPoints(java.lang.String layerId)
layerId
- the layer idpublic GPointsArray getPointsRef()
public GPointsArray getPointsRef(java.lang.String layerId)
layerId
- the layer idpublic GHistogram getHistogram()
public GHistogram getHistogram(java.lang.String layerId)
layerId
- the layer idpublic void activateZooming(float factor, int increaseButton, int decreaseButton, int increaseKeyModifier, int decreaseKeyModifier)
factor
- the zoom factor to increase or decrease with each mouse clickincreaseButton
- the mouse button to increase the zoom. It could be LEFT, RIGHT or CENTER. Select CENTER to
use the mouse wheeldecreaseButton
- the mouse button to decrease the zoom. It could be LEFT, RIGHT or CENTER. Select CENTER to
use the mouse wheelincreaseKeyModifier
- the key modifier to use in conjunction with the increase zoom mouse button. It could
be GPlot.SHIFTMOD, GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is neededdecreaseKeyModifier
- the key modifier to use in conjunction with the decrease zoom mouse button. It could
be GPlot.SHIFTMOD, GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is neededpublic void activateZooming(float factor, int increaseButton, int decreaseButton)
factor
- the zoom factor to increase or decrease with each mouse clickincreaseButton
- the mouse button to increase the zoom. It could be LEFT, RIGHT or CENTER. Select CENTER to
use the mouse wheeldecreaseButton
- the mouse button to decrease the zoom. It could be LEFT, RIGHT or CENTER. Select CENTER to
use the mouse wheelpublic void activateZooming(float factor)
factor
- the zoom factor to increase or decrease with each mouse clickpublic void activateZooming()
public void deactivateZooming()
public void activateCentering(int button, int keyModifier)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTER. Select CENTER to use the mouse wheelkeyModifier
- the key modifier to use in conjunction with the mouse button. It could be GPlot.SHIFTMOD,
GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is needpublic void activateCentering(int button)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTER. Select CENTER to use the mouse wheelpublic void activateCentering()
public void deactivateCentering()
public void activatePanning(int button, int keyModifier)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTERkeyModifier
- the key modifier to use in conjunction with the mouse button. It could be GPlot.SHIFTMOD,
GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is needpublic void activatePanning(int button)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTERpublic void activatePanning()
public void deactivatePanning()
public void activatePointLabels(int button, int keyModifier)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTERkeyModifier
- the key modifier to use in conjunction with the mouse button. It could be GPlot.SHIFTMOD,
GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is needpublic void activatePointLabels(int button)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTERpublic void activatePointLabels()
public void deactivatePointLabels()
public void activateReset(int button, int keyModifier)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTER. Select CENTER to use the mouse wheelkeyModifier
- the key modifier to use in conjunction with the mouse button. It could be GPlot.SHIFTMOD,
GPlot.CTRLMOD, GPlot.METAMOD, GPlot.ALTMOD, or GPlot.NONE if no key is needpublic void activateReset(int button)
button
- the mouse button to use. It could be LEFT, RIGHT or CENTER. Select CENTER to use the mouse wheelpublic void activateReset()
public void deactivateReset()
public void mouseEvent(MouseEvent event)
event
- the mouse event detected by the processing appletProcessing Library grafica by Javier Gracia Carpio. (c) 2015