golib
0.5
|
Classes | |
class | goPlot::CairoPlot |
Plots a graph with cairo. More... | |
class | goPlot::Graph |
Graph. Contains multiple Object2D and some axes to be drawn. Can also contain other Graphs. More... | |
class | goPlot::GraphAxis |
Axis. More... | |
class | goPlot::Object2DBox |
Box object. Draws a box. More... | |
class | goPlot::Object2DImage |
Image object. More... | |
class | goPlot::Object2DPoints |
Points object. Draws lines connecting the given 2D points. More... | |
class | goPlot::Object2DText |
2D text drawing class. Uses pango with cairo. More... | |
class | goPlot::Points2DT< Real > |
Base class for types which provide 2D points. More... | |
class | goPlot::Points2DSimple< Real > |
Simple 2D points provider. Just stores the points in a C array. More... | |
class | goPlot::Points2DMatrix< T > |
Points2D class for accessing points in a goMath::Matrix. More... | |
class | goPlot::RGBA |
Colour class with alpha channel. More... | |
class | goPlot::Trafo2DT< Real > |
Simple affine transformation representation (2x2 matrix and translation vector). More... | |
class | goPlot::Object2D |
Base class for all 2D drawable objects. More... | |
class | goPlot::LineTraits |
Line properties. More... | |
class | goPlot::FontList |
class | goPlot::TextTraits |
Text properties. Contains colour and font. More... | |
Typedefs | |
typedef double | goPlot::real |
typedef Points2DT< goDouble > | goPlot::Points2D |
typedef Trafo2DT< real > | goPlot::Trafo2D |
Functions | |
goAutoPtr< goPlot::Graph > | goPlot::plot (const goMatrixf &curve, goAutoPtr< goPlot::Graph > g=0) |
Plot a curve given as configuration matrix. More... | |
goAutoPtr< goPlot::Graph > | goPlot::plot (const goVectorf &x, const goVectorf &y, goAutoPtr< goPlot::Graph > g=0) |
Plot a curve given as coordinate vectors. More... | |
goAutoPtr< goPlot::Graph > | goPlot::plot (const goMatrixd &curve, goAutoPtr< goPlot::Graph > g=0) |
Plot a curve given as configuration matrix. More... | |
goAutoPtr< goPlot::Graph > | goPlot::plot (const goVectord &x, const goVectord &y, goAutoPtr< goPlot::Graph > g=0) |
Plot a curve given as coordinate vectors. More... | |
bool | goPlot::plot (goAutoPtr< goPlot::Graph > g, const goString &filename, int w=600, int h=400) |
Plot a graph to a file. More... | |
void | goPlot::plot (goAutoPtr< goPlot::Graph > g, cairo_t *context, int w=600, int h=400) |
@TODO Remove CairoPlot and replace with plot(). Basically we only need this function. More... | |
template<class T > | |
goAutoPtr< goPlot::Object2DPoints > | goPlot::object2D (const goMatrix< T > &curve) |
Create a goPlot::Object2DPoints for use in the goPlot library. More... | |
template<class T > | |
goAutoPtr< goPlot::Object2DPoints > | goPlot::object2D (const goVector< T > &x, const goVector< T > &y) |
Create a goPlot::Object2DPoints for use in the goPlot library. More... | |
template<class T > | |
goAutoPtr< goPlot::Object2DPoints > | goPlot::object2D (const goVector< T > &y) |
Create a goPlot::Object2DPoints for use in the goPlot library. More... | |
goAutoPtr< goPlot::Object2DImage > | goPlot::object2DImage (const goSignal3DBase< void > &img) |
Create a goAutoPtr<goPlot::Object2DImage> for use with the goPlot library. More... | |
These are the functions and classes related to plotting with Cairo. The main structure to look at is goPlot::Graph. A Graph is created and Object2D type objects can be added to it, each one having their own affine transformation, goPlot::Trafo2D. To draw a curve, e.g. use Object2DPoints and a Points2D derived class like Points2DMatrix, for text labels use Object2DText, for images Object2DImage, and so on. Graph also contains convenience functions to add some objects. You can also use the goPlot::plot functions provided for convenience, which also automatically set the dimensions of the graph. The standard transformation for a graph is identity. Plotting starts at the lower left corner, so if you draw images, you may want to flip the y axis.
This module is still quite new and growing, so more objects and functions may be added.
goAutoPtr<goPlot::Object2DPoints> goPlot::object2D | ( | const goMatrix< T > & | curve | ) |
Create a goPlot::Object2DPoints for use in the goPlot library.
Support function for using the goPlot library.
curve | 2D Points, one per row. N times 2 matrix. |
goAutoPtr<goPlot::Object2DPoints> goPlot::object2D | ( | const goVector< T > & | x, |
const goVector< T > & | y | ||
) |
Create a goPlot::Object2DPoints for use in the goPlot library.
Support function for using the goPlot library.
x | x coordinates |
y | y coordinates (must be of same size as x) |
goAutoPtr<goPlot::Object2DPoints> goPlot::object2D | ( | const goVector< T > & | y | ) |
Create a goPlot::Object2DPoints for use in the goPlot library.
Support function for using the goPlot library.
x coordinates will be filled with [0,...,y.getSize() - 1].
y | y coordinates |
goAutoPtr< goPlot::Object2DImage > goPlot::object2DImage | ( | const goSignal3DBase< void > & | img | ) |
Create a goAutoPtr<goPlot::Object2DImage> for use with the goPlot library.
The given 2D image img
is copied into a goPlot::Object2DImage
. If img
has 3 or 4 channels, they are interpreted as RGB / RGBA and converted to ARGB32 for display. 1-channel images are converted to A8 format, which is only an alpha. It may be a good idea to change this.
img | The 2D source image. |
goAutoPtr< goPlot::Graph > goPlot::plot | ( | const goMatrixd & | curve, |
goAutoPtr< goPlot::Graph > | g = 0 |
||
) |
Plot a curve given as configuration matrix.
The graph will be resized to fit.
curve | Configuration matrix, one point per row. |
g | Graph. If Null, a new graph will be created. |
g
was not null, the same as g. goAutoPtr< goPlot::Graph > goPlot::plot | ( | const goMatrixf & | curve, |
goAutoPtr< goPlot::Graph > | g = 0 |
||
) |
Plot a curve given as configuration matrix.
The graph will be resized to fit.
curve | Configuration matrix, one point per row. |
g | Graph. If Null, a new graph will be created. |
g
was not null, the same as g. goAutoPtr< goPlot::Graph > goPlot::plot | ( | const goVectord & | x, |
const goVectord & | y, | ||
goAutoPtr< goPlot::Graph > | g = 0 |
||
) |
Plot a curve given as coordinate vectors.
The graph will be resized to fit.
x | x coordinates of the points. |
y | y coordinates of the points. |
g | Graph. If Null, a new graph will be created. |
g
was not null, the same as g. goAutoPtr< goPlot::Graph > goPlot::plot | ( | const goVectorf & | x, |
const goVectorf & | y, | ||
goAutoPtr< goPlot::Graph > | g = 0 |
||
) |
Plot a curve given as coordinate vectors.
The graph will be resized to fit.
x | x coordinates of the points. |
y | y coordinates of the points. |
g | Graph. If Null, a new graph will be created. |
g
was not null, the same as g. void goPlot::plot | ( | goAutoPtr< goPlot::Graph > | g, |
cairo_t * | context, | ||
int | w = 600 , |
||
int | h = 400 |
||
) |
@TODO Remove CairoPlot and replace with plot(). Basically we only need this function.
Plot to a given Cairo context.
Use the other goPlot::plot function to plot directly to files in a more convenient way.
g | Graph to plot. |
context | Cairo context to plot to. |
w | Width of the graph in points. |
h | Height of the graph in points. |
bool goPlot::plot | ( | goAutoPtr< goPlot::Graph > | g, |
const goString & | filename, | ||
int | w = 600 , |
||
int | h = 400 |
||
) |
Plot a graph to a file.
Currently, PDF, EPS and SVG files are supported through the respective functions of Cairo.
g | Graph to plot. |
filename | Filename. The ending determines the format: one of .pdf, .eps, .svg. |
w | Width of the result in points |
h | Height of the result in points |