public final class DatanGraphics
extends java.lang.Object
Constructor and Description |
---|
DatanGraphics() |
Modifier and Type | Method and Description |
---|---|
static void |
chooseColor(int colorIndex)
Chooses a color index, determining the color of all graphics elements created after this choice until it is changed.
|
static void |
closeWorkstation()
Finalizes graphics, displays DatanGraphicsFrame (if one was opened), and closes Postscript file (if one was opened).
|
static void |
drawBoundary()
Draws a frame around the computing coordinates window.
|
static void |
drawBrokenPolyline(int ntype,
double scalef,
double[] xpl,
double[] ypl)
Draws a broken polyline.
|
static void |
drawCaption(double scalef,
java.lang.String string)
Draws a caption appearing just under the upper edge of the window in world coordinates.
|
static void |
drawContour(double x0,
double y0,
double dx,
double dy,
int nx,
int ny,
double fcont,
DatanUserFunction cuf)
Draws the contour line f(x,y) = c of a function f as a series of line segments in the x,y plane.
|
static void |
drawCoordinateCross()
Draws the axes of the computing-coordinate system as dashed lines within the window of computing coordiates.
|
static void |
drawDatapoint(int nmark,
double scalef,
double x,
double y,
double sigmax,
double sigmay,
double rho)
Draws a data point with bars, and covariance ellipse
|
static void |
drawFrame()
Draws a frame around the window in the world coordinate system.
|
static void |
drawHistogram(Histogram histogram)
Draws a histogram
|
static void |
drawMark(int nmark,
double scalef,
double xpm,
double ypm)
Draws a polymarker
|
static void |
drawPolyline(double[] xpl,
double[] ypl)
Draws a polyline.
|
static void |
drawScaleX(java.lang.String string)
Draws an axis in x-direction.
|
static void |
drawScaleY(java.lang.String string)
Draws an axis in y-direction.
|
static void |
drawText(double x,
double y,
double scalef,
java.lang.String string)
Draws a text appearing at a desired position.
|
static void |
openWorkstation(java.lang.String frametitle)
Creates a new, initially invisible DatanGraphicsFrame with the specified title
|
static void |
openWorkstation(java.lang.String frameTitle,
java.lang.String filename)
Creates a new, initially invisible DatanGraphicsFrame with the specified title.
|
static double |
roundDown(double x)
Returns a number with the sign of x and somewhat smaller than x with only few significant digits; method is
used for automatic determination of window in computing coordinates by some classes in package datangraphics which yield
a complete plot.
|
static double |
roundUp(double x)
Returns a number with the sign of x and somewhat larger than x with only few significant digits; method is
used for automatic determination of window in computing coordinates by some classes in package datangraphics which yield
a complete plot.
|
static void |
setBigClippingWindow()
Sets the clipping window to be the frame of the entire plot.
|
static void |
setFormat(double width,
double height)
Determines the Format of the plot.
|
static void |
setPaperSizeAndBorders(double paperwidth,
double paperheight,
double borderleft,
double borderright,
double borderbottom,
double bordertop)
Sets paper size and distances of used area from paper edge; if not called A4 format is assumed with 0.5 cm for all boders.
|
static void |
setParametersForScale(double fix,
double del,
int ntic,
double ticscale,
double numberscale,
boolean lnum)
Sets user defined properties for the scale drawn by the next call of drawScaleX or drawScaleY.
|
static void |
setPSColor(int index,
java.awt.Color color,
float linewidth)
Assigns color and linewidth to a color indesx for Postscript plots plots.
|
static void |
setScreenBackground(java.awt.Color color)
Assigns a color to the background of screen plots.
|
static void |
setScreenColor(int index,
java.awt.Color color,
float linewidth)
Assigns color and linewidth to a color indesx for screen plots.
|
static void |
setSmallClippingWindow()
Sets the clipping window to be the window of the computing coordinates.
|
static void |
setStandardPaperSizeAndBorders()
Sets paper size to A4 format and all boders to 0.5 cm.
|
static void |
setStandardPSColors()
Assigns standard color and linewidth values to all color indices for Postscript plots.
|
static void |
setStandardPSColorsBlackAndWhite()
Assigns standard color and linewidth values to all color indices for Postscript plots in black-and-white.
|
static void |
setStandardScreenColors()
Assigns standard color and linewidth values to all color indices for screen plots; also assigns standard color to screen plot background.
|
static void |
setViewportInWorldCoordinates(double xawc,
double xbwc,
double yawc,
double ybwc)
Establishes a viewport in world coordiates.
|
static void |
setWindowInComputingCoordinates(double xacc,
double xbcc,
double yacc,
double ybcc)
Establishes a window in computing coordiates.
|
static void |
setWindowInWorldCoordinates(double xapwc,
double xbpwc,
double yapwc,
double ybpwc)
Establishes a window in world coordiates.
|
public static void openWorkstation(java.lang.String frametitle)
frameTitle
- title of DatanGraphicsFrame; if frameTitle is blank the no DatanGraphicsFrame is initialized.public static void openWorkstation(java.lang.String frameTitle, java.lang.String filename)
frameTitle
- title of DatanGraphicsFrame; if frameTitle is blank the no DatanGraphicsFrame is initialized.filename
- name of Postscript file - has to end with either ".ps" (for postscript) or ".eps" (for encapsulated postscript).
If filename is blank, no file is initialized.public static void closeWorkstation()
public static void setWindowInComputingCoordinates(double xacc, double xbcc, double yacc, double ybcc)
xacc
- lower window edge in xxbcc
- upper window edge in xyacc
- lower window edge in yybcc
- upper window edge in ypublic static void setWindowInWorldCoordinates(double xapwc, double xbpwc, double yapwc, double ybpwc)
xapwc
- lower window edge in xxbpwc
- upper window edge in xyapwc
- lower window edge in yybpwc
- upper window edge in ypublic static void setViewportInWorldCoordinates(double xawc, double xbwc, double yawc, double ybwc)
xawc
- lower viewport edge in xxbwc
- upper viewport edge in xyawc
- lower viewport edge in yybwc
- upper viewport edge in ypublic static void chooseColor(int colorIndex)
colorindex
- index in color table; has to be >=1, <=8 for method to be effectivepublic static void drawContour(double x0, double y0, double dx, double dy, int nx, int ny, double fcont, DatanUserFunction cuf)
x0,dx,nx
- initial value, interval width and number of intervals for dividing the x axisy0,dy,ny
- same the y axisfcont
- function value c of the contour linecuf
- user function computing f(x,y) which must be an extension of DatanUserFunctionpublic static void drawCaption(double scalef, java.lang.String string)
scalef
- scale factor; the typical length of a dash is 1% of the picture diagonal multiplied by this factorstring
- string containing the encoded text of the captionpublic static void drawText(double x, double y, double scalef, java.lang.String string)
x,y
- computing coordinate designating the lower left-hand corner of the rectangle surrounding the textscalef
- scale factor; the typical length of a dash is 1% of the picture diagonal multiplied by this factorstring
- string containing the encoded textpublic static void drawHistogram(Histogram histogram)
histogram
- the histogram to be drawnpublic static void drawDatapoint(int nmark, double scalef, double x, double y, double sigmax, double sigmay, double rho)
nmark
- form of polymarker symbolizing the data point (1: open circle, 2: closed circle, 3: open sqare, 4: closed sqare, 5: open diamond, 6: closed diamond, 7: +, 8: x. 9: *)scalef
- scale factor; the diameter of the polymarker is 1% of the picture diagonal multiplied by this factorx
- x coordinate of data pointy
- y coordinate of data pointdeltax
- error in x; error bar is drawn only if deltax > 0 and if its siye would exceed the radius if the polymarkerdeltay
- error in y; error bar is drawn only if deltax > 0 and if its siye would exceed the radius if the polymarkerrho
- correlation between errors; covariance ellipse is not drawn if rho = 0 (drawing can be forced by giveng nmark a negative sign)public static void drawMark(int nmark, double scalef, double xpm, double ypm)
nmark
- form of polymarker (1: open circle, 2: closed circle, 3: open sqare, 4: closed sqare, 5: open diamond, 6: closed diamond, 7: +, 8: x. 9: *)scalef
- scale factor; the diameter of the polymarker is 1% of the picture diagonal multiplied by this factorxpm
- x coordinate of polymarkerypm
- y coordinate of polymarkerpublic static void drawPolyline(double[] xpl, double[] ypl)
xpl
- x-coordinates of polylineypl
- y-coordinates of polylinepublic static void drawBrokenPolyline(int ntype, double scalef, double[] xpl, double[] ypl)
ntype
- line type (1: dashed, 2: dotted, 3 dot-dashed)scalef
- scale factor; the typical length of a dash is 1% of the picture diagonal multiplied by this factorxpl
- x-coordinates of polylineypl
- y-coordinates of polylinepublic static void drawBoundary()
public static void drawCoordinateCross()
public static void drawFrame()
public static void setFormat(double width, double height)
width
- width of plot in centimetres; if height=0, then plot has landscape A format with width being A number,
e.g. (widhth=5, height=0) stands for landscape A5height
- height of plot in centimetres; if = width=0, then plot has portrait A format with height being A number,
e.g. (widhth=0, height=5) stands for portrait A5.
If both width=0 and height=0, then the format is set to landscape A5.public static void setSmallClippingWindow()
public static void setBigClippingWindow()
public static void drawScaleX(java.lang.String string)
string
- encoded text appearing at arrow tip accompanying the scalepublic static void drawScaleY(java.lang.String string)
string
- encoded text appearing at arrow tip accompanying the scalepublic static void setParametersForScale(double fix, double del, int ntic, double ticscale, double numberscale, boolean lnum)
fix
- value (in computing coordinates) which one wants to mark and label with a number on the axisdel
- distance between labeled tick marksntic
- number of intervals with smaller tic marks between two labeled tick marksticscale
- scale factor for tic lengthnumberscale
- scale factor for numberslnum
- defines wether the numbers on the axes are shown ind decimal (lnum=true) or exponential form (lnum=false)public static void setStandardPaperSizeAndBorders()
public static void setPaperSizeAndBorders(double paperwidth, double paperheight, double borderleft, double borderright, double borderbottom, double bordertop)
paperwidth
- width of paper in cmpaperheight
- height of paper in cmborderleft
- distance of used area from left edge in cmborderright
- distance of used area from right edge in cmbordertop
- distance of used area from top edge in cmborderbottom
- distance of used area from bottom edge in cmpublic static void setStandardScreenColors()
Background: Color(0.f, 0.f, .9f)
color index 1: Color(1.f, 1.f, 0.f), line width 2.f
color index 2: Color(1.f, 1.f, 1.f), line width 2.f
color index 3: Color(0.f, 1.f, 1.f), line width 2.f
color index 4: Color(1.f, 0.784f, 0.f), line width 2.f
color index 5: Color(1.f, 0.f, 0.f), line width 2.f
color index 6: Color(0.753f, 0.753f, 0.753f), line width 2.f
color index 7: Color(0.f, 1.f, 0.f), line width 2.f
color index 8: Color(1.f, 0.f, 1.f), line width 2.f
public static void setScreenColor(int index, java.awt.Color color, float linewidth)
index
- color index (>=1, <=8)color
- color to be assignedlinewidth
- line width (standard value is 2.f)public static void setScreenBackground(java.awt.Color color)
public static void setStandardPSColors()
Background: Color.white
color index 1: Color(0.f, 0.f, 1.f), line width 2.f
color index 2: Color(0.f, 0.f, 0.f), line width 2.f
color index 3: Color(0.f, 1.f, 0.f), line width 2.f
color index 4: Color(1.f, 0.f, 0.f), line width 2.f
color index 5: Color(1.f, 0.f, 0.f), line width 2.f
color index 6: Color(.70f, 0.f, 0.75f), line width 2.f
color index 7: Color(0.f, 1.f, 0.f), line width 2.f
color index 8: Color(1.f, 0.f, 1.f), line width 2.f
public static void setPSColor(int index, java.awt.Color color, float linewidth)
index
- color index (>=1, <=8)color
- color to be assignedlinewidth
- line width (standard value is 2.f)public static void setStandardPSColorsBlackAndWhite()
Background: Color.white
color index 1 to 8: Color.black, line width 2.f
public static double roundUp(double x)
public static double roundDown(double x)