Ox Graphics Function Reference
Chapter contents:
Tables:
- Default line and pallete attributes
- Symbol types
- Line types
- Plotting styles
Table draw.1: Default line attributes
The index argument of most functions is either an integer, corresponding to an index
in the current colour model. Or a string of up to five components
index color style symbol symbolsize:
- index: integer representing the line style index
- color: index or HTML colour name or HTML hex code (not case sensitive)
- style: [ width ] or [ width on of ]
- symbol symbolsize: the symbol is case sensitive
(rect, Rect, ...) and the symbolsize is an integer.
The table below gives the definitions of the default line styles:
0 White [15]
1 Black [10]
2 Red [15] plus 100
3 Blue [15] box 100
4 Teal [15] circle 100
5 Magenta [15 35 35] triangle 100
6 #00C000 [15 35 35] cross 100
7 Olive [15 35 35] diamond 100
8 Purple [15 160 80] Box 100
9 #FFFF80 [25 160 80] Circle 100
10 #80FF80 [35 160 80] Triangle 100
11 #80FFFF [25] Diamond 100
12 Cyan [35] uptriangle 100
13 #404040 [50] Uptriangle 100
14 Grey [15] Circle 100
15 Silver [15] Box 100
palette color (palette is for 3D surface and error fans)
-1 wireframe
0 white
1 gray
2 red
3 blue
4 blue/green
5 purple
6 green
7 brown/yellow
Table draw.2: Symbol types
"arrow" PL_ARROW
"arrow2" PL_ARROW2
"circle" PL_CIRCLE
"Circle", "filled-circle" PL_FILLCIRCLE
"cross" PL_CROSS
"dash" PL_DASH
"diamond" PL_DIAMOND
"Diamond", "filled-diamond" PL_FILLDIAMOND
"line" PL_LINE
"path" PL_PATH
"plus" PL_PLUS
"rect", "box" PL_BOX
"Rect", "Box", "filled-box" PL_FILLBOX
"Triangle", filled-triangle" PL_FILLTRIANGLE
"triangle" PL_TRIANGLE
"Uptriangle", "filled-uptriangle" PL_FILLTRIANGLEUP
"uptriangle" PL_TRIANGLEUP
Table draw.3: Line types
Table draw.4: Plotting styles
"bars" ST_BARS bars
"both","line+symbols" ST_LINESYMBOLS line and symbols
"hist" ST_HIST histogram
"index" ST_INDEX index line
"index+symbols" ST_INDEXSYMBOLS index line with symbols
"line" ST_LINE line (points connected)
"line+symbols" ST_LINESYMBOLS line and symbols
"shading" ST_SHADING shading
"symbols" ST_SYMBOLS symbols
CloseDrawWindow
#include <oxdraw.oxh>
CloseDrawWindow();
-
- No return value.
- Description.
-
Starts a new draw window for subsequent graphs.
Note that the OxMetrics graphics window
will remain active there.
A call to ShowDrawDrawing also clears the graphics buffer,
so does not need to be followed by a call to CloseDrawWindow.
Draw
#include <oxdraw.oxh>
Draw(const iArea, const mYt);
Draw(const iArea, const mYt, const dXfirst, const dXstep);
-
- iArea
- in: int, area index
- mYt
- in: m x T matrix with m rows of data
- dXfirst
- in: (optional) double, X-value of first observation, x, default is 1
- dXstep
- in: (optional) double, gap between X-values, dx, default is 1
- No return value.
- Description.
-
This function draws m variables against an X variable, where the
X variable consists of evenly spaced observations
x, x+dx, x+2dx, x+3dx, ....
Each variable is drawn by linking up the points.
The first line index is 2.
DrawAcf
#include <oxdraw.oxh>
DrawAcf(const iArea, const vY, const sY, const cLag, ...);
DrawAcf(const iArea, const vY, const sY, const cLag, const fAcf,
const fPacf, const fErrorBand, int iIndex, const fBar);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot
- sY
- in: string, variable name, or array of strings (k > 1)
- cLag
- in: int, highest lag to be used in the ACF
- fAcf
- in: int, TRUE: draw ACF (optional argument, drawn by default)
- fPacf
- in: int, TRUE: draw PACF (optional argument, not drawn by default)
- fErrorBand
- in: int, TRUE: draw error bands (optional argument, not drawn by default)
- iIndex
- in: string,int, line index, see default line attributes,
(optional argument, default is 2).
- fBar
- in: int, TRUE: draw bar plot, else draw index plot (optional argument, using bars by default)
- No return value.
- Description.
-
Draws an ACF and/or PACF.
DrawAdjust
#include <oxdraw.oxh>
DrawAdjust(const sType, ...);
-
- sType
- in: string or int, type of adjustment
- d1 ... d4
- in: optional arguments (defaults to -1 if missing)
- No return value.
- Description.
-
This function adjusts the specified area or the most recently created graphics object.
For example, immediately after a call to Draw(), you can use
DrawAdjust to change the line type.
The sType argument specifies the type of adjustment as a string (but the older method of using pre-defined constants is also possible):
"area" ADJ_AREAMATRIX area layout (area matrix), boxing and margin,
"area-3d" ADJ_AREA_3D coordinates of the 3D view point of area,
"area-color" ADJ_AREASCOLOR area color,
"area-p" ADJ_AREA_P pixel coordinates of the specified area,
"area-x" ADJ_AREA_X X world coordinates of area,
"area-y" ADJ_AREA_Y Y world coordinates of area,
"area-z" ADJ_AREA_Z Z world coordinates of area,
"axis-centre" ADJ_AXISCENTRE centre the axis labels between large ticks,
"axis-grid" ADJ_AXISGRID set grid lines for the current axis,
"axis-hide" ADJ_AXISHIDE hide the axis,
"axis-label" ADJ_AXISLABEL set the label rotation, font size, tick size
"axis-line" ADJ_AXISLINE control the axis line,
"axis-scale" ADJ_AXISSCALE set the axis scaling type
"color" ADJ_COLOR change index of line colour and style,
"model" ADJ_COLORMODEL change colour palette,
"index" ADJ_INDEX make into index line,
"legend" ADJ_LEGEND legend style,
"line-color" ADJ_LINECOLOR change line colour,
"line-style" ADJ_LINESTYLE change line style,
"minmax" ADJ_MINMAX adjust minimum and maximum $y$ value,
"paper-color" ADJ_PAPERCOLOR adjust the colour of the paper (RGB),
"paper-scale" ADJ_PAPERSCALE adjust the paper Y scale (default is 100\%),
"scale" ADJ_SCALE adjust scale, shift factor for vector line,
"symbol" ADJ_SYMBOL change symbol/line drawing mode,
"symbol-use" ADJ_SYMBOLUSE change symbol type and size.
The expected number of arguments depends on the type of adjustment
(use -1 to keep the default value):
Type d1 d2 d3 d4 d5
"area" Y areas X areas box all margin
"area-3d" area (or -1) azimuth elevation distance twist
"area-color" red:0-255 green:0-255 blue:0-255
"area-p" area (or -1) x_1 y_1 width height
"area-x" area (or -1) x_1 x_2 grow
"area-y" area (or -1) y_1 y_2 grow
"area-z" area (or -1) z_1 z_2 grow
"axis-centre" 0,1
"axis-grid" 0,1 colour type
"axis-hide" 0,1
"axis-label" rotation font size tick size
"axis-line" zero line above no line no small
"axis-scale" type scale shift
"color" line-colour line-style
"model" color palette:0-3
"index" 0,1,2 base
"legend" area (or -1) no columns font size resize box
"line-color" red:0-255 green:0-255 blue:0-255
"line-style" width:0-255 on:0-255 off:0-255
"minmax" minimum maximum
"paper-color" red:0-255 green:0-255 blue:0-255
"paper-scale" percentage
"scale" scale shift
"symbol" type size
"symbol-use" style
- "area"
Adjust the rows and columns of the area matrix from the default
For example, when there are two areas,
the default layout is 2 by 1. To put the graphs next to each other:
DrawAdjust("area", 1, 2);
- "area-3d"
expects the area number as the first argument (use -1 for most recent area). The azimuth
is the rotation along the Z axis (or, more precisely orthogonal to
the line of view). Elevation is the angle with the X-Y plane, and
twist the rotation along the line of view.
Azimuth, elevation and twist are specified in degrees,
distance is in area units.
- "area-p"
expects the area number as the first argument (use -1 for most recent area).
- "area-x", "area-y", "area-z"
all expect the area number as the first argument (use -1 for most recent area). Real-world area adjustment
does currently not work properly for 3D graphs.
All have an optional argument grow; set this to one if the area should only grow
if it already has dimensions fixed.
Set the third argument to one to box all areas. The margin size can
be changed with the fourth argument (the default is 640)
- "axis-"...] Unless explicitly created, axes are
only made once the graph is displayed. Therefore, adjustments
to an axis need to be preceeded by an explicit creation, as for
example in:
DrawT(1, x, 1960, 1, 4);
DrawAxisAuto(1, 1); // create a default X axis
DrawAdjust("axis-centre", 1);// and centre the dates
- "axis-grid" Use -1 for default colour and line type:
DrawAxisAuto(0, 1);
DrawAdjust("axis-grid", 1, -1, -1);
- "axis-label"
Rotation changes the label rotation relative to the axis,
the value is 0, 1, or -1 to leave the default.
The default font size is 300 and tick size 6;
use -1 to leave the default.
- "axis-line"
All arguments are 0, 1, or -1 to leave the default.
The second (`above') puts the labels on
the opposite side of the axis; ` no line' omits the base line
(leaving the tick marks); `no small' removes the small tick marks.
- "axis-scale"
The type for is one of:
"linear" AXIS_LINEAR standard axis,
"log" AXIS_LOG log-scale (data is in natural logarithms),
"log10" AXIS_LOG10 log10-scale (data is in base-10 logarithms),
"scaled" AXIS_SCALED scaled: set scale and shift as 2nd and 3rd value,
"date" AXIS_DATE dated: interpret as Julian date/time values.
The following example illustrates AXIS_LOG.
Logarithms are taken, and then undone along the axis to show in
the original units:
DrawT(0, log(x), 1960, 1, 4);
DrawAxisAuto(0, "Y"); // default Y axis
DrawAdjust("axis-scale", log"); // use log scale
- "color"
Either use an index (0-15) for colour and type (-1 to leave unchanged)
or a single string argument specified as this table.
DrawAdjust("color", 10, 12);
DrawAdjust("color", -1, 12);
DrawAdjust("color", "GoldenRod [80] Circle 120");
- "model"
Sets the default colour palette to which colour indices refer.
Models 0-3 are available, with 0 the defult.
- "index"
Use d1=1 to change to an index line (in that case
d2 defaults to 0), and
d1=2 to change to a bar.
The base argument is the point to which the index lines or bars are drawn.
When omitted, it is assumed to be zero.
An index line is a single vertical line, centred on the observation
values - multiple index lines will overwrite each other.
The bar type is centred on the observation value, and will make space
if multiple bars are drawn. If the bars become too thin, they will become
a single line drawn in the colour, instead of a black outline filled with the
colour.
- "minmax"
Sets the minimum and maximum of the previous vector or histogram object.
This implies that the area will encompass these values, and therefore
differs from "area-y", which enforces a Y range.
- "paper-color"
Sets the color of the paper (outside the areas).
- "paper-scale"
This adjust the Y scale as a percentage of the original. E.g. use 50% to set
half size:
DrawAdjust("paper-scale", 50);
- "symbol"
The symbol type can be a string or int, see default line attributes.
- "symbol-use"
Style can be string or intas per Table~\ref{TabPlotStyles}: 0=line, 1=symbols, 2=both, etc. An example drawing both:
DrawT(0, x, 1960, 1, 4);
DrawAdjust("symbol-use", "both");
DrawAdjust("symbol", "circle", 150);
DrawAxis,
DrawAxisAuto
#include <oxdraw.oxh>
DrawAxis(const iArea, const iIsXaxis, const dAnchor,
const dAxmin, const dAxmax, const dFirstLarge,
const dLargeStep, const dSmallStep, const iFreq);
DrawAxis(const iArea, const iIsXaxis, const dAnchor,
const dAxmin, const dAxmax, const dFirstLarge,
const dLargeStep, const dSmallStep, const iFreq,
const dAnchor2);
DrawAxisAuto(const iArea, const iIsXaxis, ...);
DrawAxisAuto(const iArea, const iIsXaxis, const fShow,
const iAnchor, const dAnchor, const dAnchor2);
-
- iArea
- in: int, area index
- iIsXaxis
- in: "X" or 1: X axis, "Y" or 0: Y axis, "Z" or 2: Z axis
- dAnchor
- in: int, if iAnchor=ANCHOR_USER: anchor of the axis (Y location of X, X location of Y and Z axis)
- dAxmin
- in: axis minimum
- dAxmax
- in: axis maximum
- dFirstLarge
- in: location of first large tick
- dLargeStep
- in: step size between large ticks
- dSmallStep
- in: step size between small ticks
- iFreq
- in: int, frequency (for time series X-axis, set to 0 otherwise)
- fShow
- in: int, TRUE: show the axis
- iAnchor
- in: axis anchor location, "min" or ANCHOR_MIN: at minimum,
"max" or ANCHOR_MAX: at maximum, "user" or ANCHOR_USER: at dAnchor
- dAnchor2
- in: int, if iAnchor=ANCHOR_USER: anchor of the 3D axis (Z location of X and Y axis, Y location of Z)
- No return value.
DrawBoxPlot
#include <oxdraw.oxh>
DrawBoxPlot(const iArea, const vY, const sY);
DrawBoxPlot(const iArea, const vY, const sY, const iIndex);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot (needs T>5)
- sY
- in: string, variable name, or array of strings (k > 1)
- iIndex
- in: string,int, line index, see default line attributes,
(optional argument, default is 2).
- No return value.
DrawCorrelogram
#include <oxdraw.oxh>
DrawCorrelogram(const iArea, const vY, const sY, const cLag);
DrawCorrelogram(const iArea, const mY, const sY, const cLag, const iIndex);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot
- sY
- in: string, variable name, or array of strings (k > 1)
- cLag
- in: int, highest lag to be used in correlogram
- iIndex
- in: string,int, line index, see default line attributes,
(optional argument, default is 2).
- No return value.
- Description.
-
Draws a correlogram (the ACF is computed slightly differently from
acf). This function
has been replaced by DrawAcf.
DrawDensity
#include <oxdraw.oxh>
DrawDensity(const iArea, const vY, const sY, ...);
DrawDensity(const iArea, const vY, const sY, const fDens, const fHist,
const fNormal, BOOL fCdf, BOOL fStand, const cBar, const iIndex);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot
- sY
- in: string, variable name, or array of strings (k > 1)
- fDens
- in: int, TRUE: draw estimated density (optional argument, default)
- fHist
- in: int, TRUE: draw histogram (optional argument, not drawn by default)
- fNormal
- in: int, TRUE: add the normal density with same mean and variance for reference (optional argument, not drawn by default)
- fCdf
- in: int, TRUE: plot the CDF in separate area (optional argument, not drawn by default);
this is drawn as a QQ plot against the normal with same mean and variance (unless fStand=TRUE)
- fStand
- in: int, TRUE: use standardized data (optional argument, default uses original data)
- cBar
- in: int, number of bars (0: use default; optional argument)
- iIndex
- in: string,int, line index, see default line attributes,
(optional argument, default is 2).
- No return value.
- Description.
-
Draws the histogram and/or
density
of the data in the specified area. When fNormal is TRUE,
a normal density with the same mean and variance as the data
will be drawn.
DrawHistogram
#include <oxdraw.oxh>
DrawHistogram(const iArea, const vBar, ...);
DrawHistogram(const iArea, const vBar, const dMin, const dStep,
const iIndex, const iColorFill);
-
- iArea
- in: int, area index
- vBar
- in: k x T matrix with bar heights, each row is a new plot
- dMin
- in: double, first X-coordinate of histogram (optional argument, default is 1)
- dStep
- in: double, bar step size (optional argument, default is 1)
- iIndex
- in: string,int, line index, see default line attributes,
(optional argument, default is 2).
- iColorFill
- in: int, colour index to fill the bars, see default line attributes,
(optional argument, default is none).
- No return value.
- Description.
-
Draws a histogram when the data is already in histogram
format, i.e. vBar contains the bar heights.
DrawLegend
#include <oxdraw.oxh>
DrawLegend(const iArea, const iOffsX, const iOffsY,
const fHidden);
-
- iArea
- in: int, area index
- iOffsX
- in: int, X pixel offset from top left
- iOffsY
- in: int, Y pixel offset from top left
- fHidden
- in: int, TRUE: hide the legend
- No return value.
- Description.
-
DrawLegend determines the location of the legend.
By default, a legend is drawn in the top left-hand corner,
with a scale that adjusts automatically to the area size.
DrawLegend can also be used to hide the legend.
The content of the legend is determined by the
variable names that are used when drawing vectors.
DrawLine
#include <oxdraw.oxh>
DrawLine(const iArea, const dX1, const dY1, const dX2,
const dY2, const iIndex);
DrawLine(const iArea, const dX1, const dY1, const dZ1,
const dX2, const dY2, const dZ2, const iIndex);
-
- iArea
- in: int, area index
- dX1, dY1
- in: int, real-world coordinates of starting point
- dX2, dY2
- in: int, Y real-world coordinates of end point
- dZ1, dZ2
- in: int, real-world Z coordinates for symbol in 3D graph
- iIndex
- in: string,int, line index for first row, see default line attributes.
- No return value.
DrawMatrix
#include <oxdraw.oxh>
DrawMatrix(const iArea, const mYt, const asY,
const dXfirst, const dXstep, ...);
DrawMatrix(const iArea, const mYt, const asY,
const dXfirst, const dXstep, iSymbol, iIndex);
-
- iArea
- in: int, area index
- mYt
- in: m x T matrix with m rows of data
- asY
- in: array of strings (holds variable names), or 0 (no names)
- dXfirst
- in: double, X-value of first observation, x
- dXstep
- in: double, gap between X-values, dx
- iSymbol
- in: string ("line", "symbols", "both", see Plotting styles)
- or: int (0: line, 1: symbols, 2: both, see Plotting styles)
- or: Or array of strings with value for each row of data
- or: Or array of strings or vector with value for each row of data
(optional argument, default is 0).
- iIndex
- in: string,int, line index for first row, see default line attributes,
(optional argument, default is 2).
Each subsequent row will have the next index.
Or array of strings or vector with value for each row of data.
- No return value.
- Description.
-
This is a more flexible version of the Draw() function.
DrawMatrix draws the m variables in the rows of mYt.
The X variable consists of evenly spaced observations
x, x+dx, x+2dx, x+3dx, ....
DrawPath
DrawPPath
#include <oxdraw.oxh>
DrawPath(const iArea, const vPath, ...);
DrawPath(const iArea, const vPath, const iIndex, const iColorFill);
DrawPath(const iArea, const iX1, const iY1, const iX1, const iY1,
const vPath, ...);
DrawPath(const iArea, const iX1, const iY1, const iX1, const iY1,
const vPath, const iIndex, const iColorFill);
-
- iArea
- in: int, area index
- vPath
- in: string, array, matrix, SVG path data
- iIndex
- in: string,int, line index for stroke color, see default line attributes (default 1).
- iColorFill
- in: string,int, line index for fill color (default -1).
- iX1, iY1, iX2, iY2
- in: pixel box for path
- No return value.
DrawPPath
#include <oxdraw.oxh>
DrawPath(const iArea, const iX1, const iY1, const iX1, const iY1,
const vPath, ...);
DrawPath(const iArea, const iX1, const iY1, const iX1, const iY1,
const vPath, const iIndex, const iColorFill);
-
- iArea
- in: int, area index
- iX1, iY1, iX2, iY2
- in: pixel box for path
- vPath
- in: vector, SVG path data
- iIndex
- in: string,int, line index for stroke color, see default line attributes (default 1).
- iColorFill
- in: string,int, line index for fill color (default -1).
- No return value.
- Description.
-
DrawPath draws an SVG path. The path is one or more svg path, circle, ellipse, polygon or rect statements, specified in real world coordinates. The \texttt{vPath} argument can come in three formats:
- a string with svg code. Note that embedded double quotes must be escaped, unless used inside a raw string:
decl svg2 =
`
- an array, where each element is an array consisting of type and coordinates, e.g.
{{"M", 300, 200}, {"h", -50}, {"a", 50, 50, 0, 1,0, 50,-50}, {"z"}}
- a matrix[n][2], with only the data, where the first entry is treated as "M" and the rest as "L".
DrawPPath draws an SVG path in a pixel box. The path is one or more svg path, circle, ellipse, polygon or rect statements, which is positioned inside the pixel box.
An example is given in samples/graphics/drawpath.ox.
DrawPLine,
DrawPSymbol,
DrawPText
#include <oxdraw.oxh>
DrawPLine(const iArea, const iX1, const iY1, const iX2,
const iY2, const iIndex);
DrawPSymbol(const iArea, const iX1, const iY1, const iX2,
const iY2, const iSymType, const iIndex);
DrawPText(const iArea, const sText, const iPx1,
const iPy1, ...);
DrawPText(const iArea, const sText,const iPx1,const iPy1,
const iFontNo, const iFontSize, const iTitle, const iRotation);
- No return value.
- Description.
-
Pixel coordinate versions of
DrawLine, DrawSymbol
DrawText.
DrawQQ
#include <oxdraw.oxh>
DrawQQ(const iArea, const vY, const sY, const iDens,
const df1, const df2);
DrawQQ(const iArea, const mY, const sY, const iDens,
const df1, const df2, const iIndex, const dCrit);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot
- sY
- in: string, variable name, or array of strings (k > 1)
- iDens
- in: int, one of: QQ_CHI, QQ_F, QQ_N, QQ_T, QQ_U
- df1
- in: double, first parameter for distribution
- df2
- in: double, second parameter for distribution
- iIndex
- in: string,int, line index for first row, see default line attributes,
(optional argument, default is 2)
- dCrit
- in: double, critical value for error bands (default is 0 for no bands).
- No return value.
- Description.
-
Draws a QQ plot.
The following distributions are supported:
- QQ_CHI : chi ^2(df1),
- QQ_F : F(df1, df2),
- QQ_N : N(0, 1),
- QQ_N_SE : N(0, 1), with pointwise asymptotic 95% standard error
bands, as derived in Engler and Nielsen(2009),
- QQ_T : t(df1),
- QQ_U : Uniform(0,1), resulting in a Quantile plot.
DrawSpectrum
#include <oxdraw.oxh>
DrawSpectrum(const iArea, const vY, const sY, const iOrder);
DrawSpectrum(const iArea, const mY, const sY, const iOrder,
const iIndex);
-
- iArea
- in: int, area index
- vY
- in: k x T matrix, each row is a new plot
- sY
- in: string, variable name, or array of strings (k > 1)
- iOrder
- in: int, lag truncation parameter m
- iIndex
- in: string,int, line index for first row, see default line attributes,
(optional argument, default is 2).
- No return value.
- Description.
-
Draws the estimated spectral density.
DrawSymbol
#include <oxdraw.oxh>
DrawSymbol(const iArea, const dX1, const dY1, const dX2,
const dY2, const iSymType, const iIndex);
DrawSymbol(const iArea, const dX1, const dY1, const dZ1, const dX2,
const dY2, const dZ2, const iSymType, const iIndex);
-
- iArea
- in: int, area index
- dX1, dY1
- in: int, real-world coordinates, lower-left corner of bounding box
- dX2, dY2
- in: int, real-world coordinates, upper-right corner of bounding box
- dZ1, dZ2
- in: int, real-world Z coordinates for symbol in 3D graph
- iSymType
- in: int or string, symbol type
- iIndex
- in: string,int, line index for first row, see default line attributes,
(optional argument, default is 2).
Each subsequent row will have the next index.
- No return value.
DrawT
#include <oxdraw.oxh>
DrawT(const iArea, const mYt, const mnYear,
const mnPeriod, const iFreq);
DrawT(const iArea, const mYt, const vDates, 0, 0);
-
- iArea
- in: int, area index
- mYt
- in: m x T matrix with m y variables
- mnYear
- in: int, year of first observation
- mnPeriod
- in: int, period of first observation
- iFreq
- in: int, frequency of observations
- vDates
- in: 1 x T matrix with with Julian dates (and/or times,
see dayofcalendar and
timeofday)
- No return value.
- Description.
-
Draws m variables in the specified area against time.
Each variable is drawn by linking up the points.
The first line index is 2.
DrawText,
DrawTitle
#include <oxdraw.oxh>
DrawText(const iArea, const sText, const dX1,
const dY1, ...);
DrawText(const iArea, const sText, const dX1, const dY1,
const iFontNo, const iFontSize, const iTitle, const iRotation,
const dZ1);
DrawTitle(const iArea, const sText);
-
- iArea
- in: int, area index
- sText
- in: string, the text may include LaTeX-style formatting
- dX1, dY1
- in: int, real-world coordinates, anchor of text
- iFontNo
- in: int, font number (0 for first font; use -1 for the default font)
- iFontSize
- in: int, font size (e.g. 330; use -1 for the default size)
- iTitle
- in: int,
TEXT_TEXT or 0: is normal text, else is graph title (coordinates are ignored):
TEXT_TITLE - graph title
TEXT_XLABEL - label along X-axis
TEXT_YLABEL - label along Y-axis
TEXT_ZLABEL - label along Z-axis
- iRotation
- in: int, rotation (in degrees, default is 0), only effective if the iTitle argument is zero
- dZ1
- in: int, real-world Z coordinate of text anchor (for text in 3D graphs; default is 0)
- No return value.
- Description.
-
Note that the forward slash for LaTeX commands
must be doubled, for example:
DrawText(0, "$\\leftarrow\\arrowext$", 1962, 1, -1, -1, 0, 45);
DrawTitle draws text at the title location. This corresponds to
DrawText(iArea, sText, 0, 0, -1, -1, TEXT_TITLE).
Text can also be rotated, by specifying the angle in degrees.
This will not work well for multiple
line text blocks.
DrawTMatrix
#include <oxdraw.oxh>
DrawTMatrix(const iArea, const mYt, const asY, ...);
DrawTMatrix(const iArea, const mYt, const asY,
const mnYear, const mnPeriod, const iFreq, iSymbol,
iIndex);
DrawTMatrix(const iArea, const mYt, const asY, const vDates,...);
DrawTMatrix(const iArea, const mYt, const asY, const vDates,
0, 0, const iSymbol, const iIndex);
-
- iArea
- in: int, area index
- mYt
- in: m x T matrix with m y variables
- asY
- in: array of strings (holds variable names), or 0 (no names)
- mnYear
- in: int, year of first observation
- mnPeriod
- in: int, period of first observation
- iFreq
- in: int, frequency of observations
- iSymbol
- in: string ("line", "symbols", "both", see Plotting styles)
- or: int (0: line, 1: symbols, 2: both, see Plotting styles)
- or: Or array of strings with value for each row of data
- or: Or array of strings or vector with value for each row of data
(optional argument, default is 0).
- iIndex
- in: string,int, line index for first row, see Default line attributes,
(optional argument, default is 2).
Each subsequent row will have the next index.
Or array of strings or vector with value for each row of data.
- vDates
- in: 1 x T matrix with with Julian dates (and/or times,
see dayofcalendar and
timeofday)
- No return value.
- Description.
-
This is a more flexible version of the DrawT() function.
Draws m variables in the specified area against time.
See under DrawMatrix for the default settings for each line index.
See ox/samples/graphics/draw10.ox for an example using
fixed frequency, daily and timed data.
See Modelbase::DbDrawTMatrix
for a version that uses the database sample information for the horizontal axis.
DrawX
#include <oxdraw.oxh>
DrawX(const iArea, const mYt, const vX);
-
- iArea
- in: int, area index
- mYt
- in: m x T matrix with m y variables
- vX
- in: 1 x T matrix with x variable
- No return value.
- Description.
-
Draws m y variables in the specified area against an x variable.
Each point is marked, but the points are not linked, resulting in a cross plot.
The first line index is 2.
DrawXMatrix
#include <oxdraw.oxh>
DrawXMatrix(const iArea, const mYt, const asY, const vX,
const sX, ...);
DrawXMatrix(const iArea, const mYt, const asY, const vX,
const sX, iSymbol, iIndex);
-
- iArea
- in: int, area index
- vX
- in: 1 x T matrix with x variable
- iSymbol
- in: string ("line", "symbols", "both", see Plotting styles)
- or: int (0: line, 1: symbols, 2: both, see Plotting styles)
- or: Or array of strings with value for each row of data
- or: Or array of strings or vector with value for each row of data
(optional argument, default is 0).
- iIndex
- in: string,int, line index for first row, see Default line attributes,
(optional argument, default is 2).
Each subsequent row will have the next index.
Or array of strings or vector with value for each row of data.
- No return value.
- Description.
-
This is a more flexible version of the DrawX() function.
Draws m variables in the specified area against an x variable
See under DrawMatrix for the default settings for each line index.
See ox/samples/graphics/draw11.ox for an example using
fixed frequency and daily data.
DrawXYZ
#include <oxdraw.oxh>
DrawXYZ(const iArea, const vX, const vY, const mZ, ...);
DrawXYZ(const iArea, const vX, const vY, const mZ,
const iMode, const sX, const sY, const sZ,
const iPalette, const iIndex);
-
- iArea
- in: int, area index
- vX
- in: 1 x k matrix with X variable
- vY
- in: 1 x n matrix with Y variable
- mZ
- in: k x n matrix with Z variable, heights above XY plane
(tabular format)
or
- in: 1 x n=k matrix with Z coordinates for points
(X, Y, Z), rough approximation of surface is constructed (scatter format)
- iMode
- in: int, type of plot (optional argument):
-1 - triangulation (only for scatter format)
0 - surface plot only (default)
1 - currently unsupported: surface plot with contours on ground level
2 - 2-dimensional contour plot
- sX
- in: string, name of X variable (optional argument)
- sY
- in: string, name of Y variable (optional argument)
- sZ
- in: string, name of Z variable (optional argument)
- iPalette
- in: int, palette index, see Default line attributes,
(optional argument, default is 2: red).
- iIndex
- in: string,int, line index for mesh, see Default line attributes,
(optional argument, default is 1: black).
- No return value.
DrawZ
#include <oxdraw.oxh>
DrawZ(const vZ, ...);
DrawZ(const vZ, const sZ, const iMode, const dFac,
const iIndex);
-
- iArea
- in: int, area index
- vZ
- in: 1 x T matrix with Z variable
- sZ
- in: string, 1 name of Z variable
- iMode
- in: int, type of Z variable (optional argument):
ZMODE_SYMBOL - use values as symbol size,
ZMODE_VALUE - draw value as text,
ZMODE_BAR - draw error bars (the default),
ZMODE_BAND - draw error bands,
ZMODE_FAN - draw error fans,
ZMODE_HILO - draw high-low plot,
ZMODE_3D - draw 3-D points.
- dFac
- in: double, bar/band factor (optional argument, 2.0 is default)
- iIndex
- in: string,int, line index for first row, see Default line attributes,
(optional argument, default is 2).
Each subsequent row will have the next index.
- No return value.
- Description.
-
DrawZ adds a Z component to the most recent graphics
object. DrawZ should be used
immediately after a call to one of the draw functions
Draw, DrawMatrix, DrawX, etc.).
SaveDrawWindow
#include <oxdraw.oxh>
SaveDrawWindow(const sFilename);
-
- sFilename
- in: valid file name
- No return value.
- Description.
-
Saves the current graph to the specified file. The file
format for saving is derived from the extension.
The following formats are supported:
- .gwg : OxMetrics graphics file
- .pdf : PDF: Portable document format
- .svg : SVG format
See the OxMetrics book for a description of these formats.
When saving in a format other than .gwg, the .gwg file is automatically saved as well (using the
same file name with .gwg appended).
SetDrawWindow
#include <oxdraw.oxh>
SetDrawWindow(const sTitle);
-
- sTitle
- in: string, name of window
- No return value.
- Description.
-
This function is only relevant when interacting with OxMetrics
otherwise it does nothing. It sets the name of
the OxMetrics window in which the graphs of the Ox program
appear to sTitle.
SetTextWindow
#include <oxdraw.oxh>
SetTextWindow(const sTitle);
-
- sTitle
- in: string, name of window
- No return value.
- Description.
-
This function is only relevant when interacting with OxMetrics
otherwise it does nothing. It sets the name of
the OxMetrics window in which the output (from the print() function)
of the Ox program appears to sTitle.
ShowDrawWindow
#include <oxdraw.oxh>
ShowDrawWindow();
-
- No return value.
- Description.
-
Shows the drawing. Note that in some implementations the graphs
cannot be displayed. Then a message is printed
(SaveDrawWindow() will still work in that case!).
A call to ShowDrawWindow also clears the drawing buffer,
so does not need to be followed by a call to CloseDrawWindow.
Therefore, two subsequent calls to ShowDrawWindow first show,
then clear the graph from the active window.
Ox version 10.0.
©
JA Doornik
This file last changed .