|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectij.gui.Plot
public class Plot
This class is an image that line graphs can be drawn on and displayed.
| Field Summary | |
|---|---|
static int |
BOTTOM_MARGIN
the margin width below the plot frame |
static int |
BOX
Display points using an box-shaped mark. |
static int |
CENTER
Text justification. |
static int |
CIRCLE
Display points using a circle 5 pixels in diameter. |
static int |
CROSS
Display points using an cross-shaped mark. |
static int |
DEFAULT_FLAGS
the default flags |
static int |
DOT
Display points using a single pixel. |
static int |
LEFT
Text justification. |
static int |
LEFT_MARGIN
the margin width left of the plot frame (enough for 5-digit numbers such as unscaled 16-bit |
static int |
LINE
Connect points with solid lines. |
static int |
RIGHT
Text justification. |
static int |
RIGHT_MARGIN
the margin width right of the plot frame |
static int |
TOP_MARGIN
the margin width above the plot frame |
static int |
TRIANGLE
Display points using an tiangular mark. |
static int |
X
Display points using an X-shaped mark. |
static int |
X_FORCE2GRID
flag for forcing frame to coincide with the grid/ticks in x direction (results in unused space) |
static int |
X_GRID
flag for drawing vertical grid lines for x-axis ticks |
static int |
X_LOG_NUMBERS
flag for logarithmic labels of x-axis ticks |
static int |
X_MINOR_TICKS
flag for drawing x-axis minor ticks |
static int |
X_NUMBERS
flag for numeric labels of x-axis ticks |
static int |
X_TICKS
flag for drawing x-axis ticks |
static int |
Y_FORCE2GRID
flag for forcing frame to coincide with the grid/ticks in y direction (results in unused space) |
static int |
Y_GRID
flag for drawing horizontal grid lines for y-axis ticks |
static int |
Y_LOG_NUMBERS
flag for logarithmic numeric labels of x-axis ticks |
static int |
Y_MINOR_TICKS
flag for drawing y-axis minor ticks |
static int |
Y_NUMBERS
flag for numeric labels of x-axis ticks |
static int |
Y_TICKS
flag for drawing x-axis ticks |
| Constructor Summary | |
|---|---|
Plot(String title,
String xLabel,
String yLabel)
This is a version of the constructor with no intial arrays. |
|
Plot(String title,
String xLabel,
String yLabel,
double[] xValues,
double[] yValues)
This version of the constructor accepts double arrays. |
|
Plot(String title,
String xLabel,
String yLabel,
double[] xValues,
double[] yValues,
int flags)
This version of the constructor accepts double arrays and has a 'flags' argument. |
|
Plot(String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues)
Construct a new PlotWindow. |
|
Plot(String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues,
int flags)
This version of the constructor has a 'flags' argument for controlling the appearance of ticks, grid, etc. |
|
Plot(String title,
String xLabel,
String yLabel,
int flags)
This is a version of the constructor with no intial arrays. |
|
Plot(String dummy,
String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues)
This is a constructor that works with JavaScript. |
|
| Method Summary | |
|---|---|
void |
addErrorBars(double[] errorBars)
Adds vertical error bars to the plot. |
void |
addErrorBars(float[] errorBars)
Adds vertical error bars to the plot. |
void |
addErrorBars(String dummy,
float[] errorBars)
This is a version of addErrorBars that works with JavaScript. |
void |
addHorizontalErrorBars(double[] errorBars)
Adds horizontal error bars to the plot. |
void |
addLabel(double x,
double y,
String label)
Draws text at the specified location, where (0,0) is the upper left corner of the the plot frame and (1,1) is the lower right corner. |
void |
addPoints(ArrayList x,
ArrayList y,
ArrayList z,
int shape)
Adds a set of points to the plot using double ArrayLists. |
void |
addPoints(ArrayList x,
ArrayList y,
int shape)
Adds a set of points to the plot using double ArrayLists. |
void |
addPoints(double[] x,
double[] y,
double[] errorBars,
int shape)
Adds a set of points to the plot or adds a curve if shape is set to LINE. |
void |
addPoints(double[] x,
double[] y,
int shape)
Adds a set of points to the plot using double arrays. |
void |
addPoints(float[] x,
float[] y,
int shape)
Adds a set of points to the plot or adds a curve if shape is set to LINE. |
void |
addPoints(String dummy,
float[] x,
float[] y,
int shape)
This a version of addPoints that works with JavaScript. |
double |
calculateDistance(int x1,
int y1,
int x2,
int y2)
|
void |
changeFont(Font font)
Obsolete; replaced by setFont(). |
void |
draw()
Draws the plot specified in the constructor. |
void |
drawArrow(int x1,
int y1,
int x2,
int y2,
double size)
|
void |
drawDottedLine(double x1,
double y1,
double x2,
double y2,
int step)
|
void |
drawLine(double x1,
double y1,
double x2,
double y2)
|
void |
drawNormalizedLine(double x1,
double y1,
double x2,
double y2)
Draws a line using a normalized 0-1, 0-1 coordinate system, with (0,0) at the top left and (1,1) at the lower right corner. |
void |
drawVectors(ArrayList x1,
ArrayList y1,
ArrayList x2,
ArrayList y2)
Adds a set of vectors to the plot using double ArrayLists. |
void |
drawVectors(double[] x1,
double[] y1,
double[] x2,
double[] y2)
Adds a set of points that will be drawn as ARROWs. |
double[] |
getDoubleFromArrayList(ArrayList list)
|
ImagePlus |
getImagePlus()
Returns the plot as an ImagePlus. |
ImageProcessor |
getProcessor()
Returns the plot as an ImageProcessor. |
void |
setAxes(boolean xLog,
boolean yLog,
boolean xTicks,
boolean yTicks,
boolean xMinorTicks,
boolean yMinorTicks,
int tickLenght,
int minorTickLenght)
Sets the properties of the axes. |
void |
setAxisXLog(boolean axisXLog)
Sets the X Axis format to Log or Linear. |
void |
setAxisYLog(boolean axisYLog)
Sets the Y Axis format to Log or Linear. |
void |
setColor(Color c)
Changes the drawing color. |
void |
setFont(Font font)
Sets the font. |
void |
setFrameSize(int width,
int height)
Sets the plot frame size in pixels. |
void |
setJustification(int justification)
Sets the justification used by addLabel(), where justification
is Plot.LEFT, Plot.CENTER or Plot.RIGHT. |
void |
setLimits(double xMin,
double xMax,
double yMin,
double yMax)
Sets the x-axis and y-axis range. |
void |
setLineWidth(int lineWidth)
Changes the line width. |
void |
setLogScaleX()
|
void |
setLogScaleY()
|
void |
setMaxIntervals(int intervals)
Sets the maximum number of intervals in a plot. |
void |
setMinorTickLength(int minorTickLength)
Sets the length of the minor tick in pixels. |
void |
setPlotMaker(PlotMaker plotMaker)
|
void |
setSize(int width,
int height)
Sets the canvas size (i.e., size of the resulting ImageProcessor). |
void |
setTickLength(int tickLength)
Sets the length of the major tick in pixels. |
void |
setXLabelFont(Font font)
Sets the xLabelFont. |
void |
setXMinorTicks(boolean XMinorTicks)
Sets the X Axis minor ticks. |
void |
setXTicks(boolean XTicks)
Sets the X Axis ticks. |
void |
setYLabelFont(Font font)
Sets the yLabelFont. |
void |
setYMinorTicks(boolean YMinorTicks)
Sets the Y Axis minor ticks. |
void |
setYTicks(boolean YTicks)
Sets the Y Axis ticks. |
PlotWindow |
show()
Displays the plot in a PlotWindow and returns a reference to the PlotWindow. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LEFT
public static final int CENTER
public static final int RIGHT
public static final int CIRCLE
public static final int X
public static final int BOX
public static final int TRIANGLE
public static final int CROSS
public static final int DOT
public static final int LINE
public static final int X_NUMBERS
public static final int Y_NUMBERS
public static final int X_TICKS
public static final int Y_TICKS
public static final int X_GRID
public static final int Y_GRID
public static final int X_FORCE2GRID
public static final int Y_FORCE2GRID
public static final int X_MINOR_TICKS
public static final int Y_MINOR_TICKS
public static final int X_LOG_NUMBERS
public static final int Y_LOG_NUMBERS
public static final int DEFAULT_FLAGS
public static final int LEFT_MARGIN
public static final int RIGHT_MARGIN
public static final int TOP_MARGIN
public static final int BOTTOM_MARGIN
| Constructor Detail |
|---|
public Plot(String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues)
title - the window titlexLabel - the x-axis labelyLabel - the y-axis labelxValues - the x-coodinates, or nullyValues - the y-coodinates, or null
public Plot(String title,
String xLabel,
String yLabel,
double[] xValues,
double[] yValues)
public Plot(String dummy,
String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues)
public Plot(String title,
String xLabel,
String yLabel)
public Plot(String title,
String xLabel,
String yLabel,
int flags)
public Plot(String title,
String xLabel,
String yLabel,
float[] xValues,
float[] yValues,
int flags)
public Plot(String title,
String xLabel,
String yLabel,
double[] xValues,
double[] yValues,
int flags)
| Method Detail |
|---|
public void setLimits(double xMin,
double xMax,
double yMin,
double yMax)
public void setSize(int width,
int height)
public void setFrameSize(int width,
int height)
public void setMaxIntervals(int intervals)
public void setTickLength(int tickLength)
public void setMinorTickLength(int minorTickLength)
public void setAxisXLog(boolean axisXLog)
public void setAxisYLog(boolean axisYLog)
public void setXTicks(boolean XTicks)
public void setYTicks(boolean YTicks)
public void setXMinorTicks(boolean XMinorTicks)
public void setYMinorTicks(boolean YMinorTicks)
public void setAxes(boolean xLog,
boolean yLog,
boolean xTicks,
boolean yTicks,
boolean xMinorTicks,
boolean yMinorTicks,
int tickLenght,
int minorTickLenght)
public void setLogScaleX()
public void setLogScaleY()
public void addPoints(float[] x,
float[] y,
int shape)
x - the x-coodinatesy - the y-coodinatesshape - CIRCLE, X, BOX, TRIANGLE, CROSS, DOT or LINE
public void addPoints(double[] x,
double[] y,
int shape)
public void addPoints(String dummy,
float[] x,
float[] y,
int shape)
public void addPoints(ArrayList x,
ArrayList y,
int shape)
public void addPoints(double[] x,
double[] y,
double[] errorBars,
int shape)
x - the x-coodinatesy - the y-coodinateserrorBars - the vertical error barsshape - CIRCLE, X, BOX, TRIANGLE, CROSS, DOT or LINE
public void addPoints(ArrayList x,
ArrayList y,
ArrayList z,
int shape)
public double[] getDoubleFromArrayList(ArrayList list)
public void drawVectors(double[] x1,
double[] y1,
double[] x2,
double[] y2)
x1 - the x-coodinates of the beginning of the arrowy1 - the y-coodinates of the beginning of the arrowx2 - the x-coodinates of the end of the arrowy2 - the y-coodinates of the end of the arrow
public double calculateDistance(int x1,
int y1,
int x2,
int y2)
public void drawArrow(int x1,
int y1,
int x2,
int y2,
double size)
public void drawVectors(ArrayList x1,
ArrayList y1,
ArrayList x2,
ArrayList y2)
public void addErrorBars(float[] errorBars)
public void addErrorBars(double[] errorBars)
public void addErrorBars(String dummy,
float[] errorBars)
public void addHorizontalErrorBars(double[] errorBars)
public void addLabel(double x,
double y,
String label)
public void setJustification(int justification)
justification
is Plot.LEFT, Plot.CENTER or Plot.RIGHT.
public void setColor(Color c)
setColor before draw.
The frame and labels are always drawn in black.
public void setLineWidth(int lineWidth)
public void drawLine(double x1,
double y1,
double x2,
double y2)
public void drawNormalizedLine(double x1,
double y1,
double x2,
double y2)
public void drawDottedLine(double x1,
double y1,
double x2,
double y2,
int step)
public void setFont(Font font)
public void setXLabelFont(Font font)
public void setYLabelFont(Font font)
public void changeFont(Font font)
public void draw()
public ImageProcessor getProcessor()
public ImagePlus getImagePlus()
public PlotWindow show()
public void setPlotMaker(PlotMaker plotMaker)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||