Module to generate 2d plots. Right now the output is in xfig format.
This could be re-implement this using libplot. However this is not urgent at all since 2d plots are not very useful.
- See Also
- Tplot, plot.c, Tplot3d, plot3d.h
Definition in file plot.h.
|
void | InitPlot (const char *name, Tplot *p) |
| Constructor. More...
|
|
void | SetLineWidth (unsigned int width, Tplot *p) |
| Changes the current line width. More...
|
|
void | SetLineStyle (unsigned int style, Tplot *p) |
| Changes the current line stype. More...
|
|
void | SetOrigin (double offset_x, double offset_y, Tplot *p) |
| Changes the current origin of the plot. More...
|
|
void | SetPenColor (int color, Tplot *p) |
| Changes the current pen color. More...
|
|
void | SetFillColor (int color, Tplot *p) |
| Changes the current fill color. More...
|
|
void | SetFillIntensity (unsigned int intensity, Tplot *p) |
| Changes the current fill intensity. More...
|
|
void | SetDepth (unsigned int depth, Tplot *p) |
| Changes the current plot depth. More...
|
|
void | PlotCircle (double cx, double cy, double r, Tplot *p) |
| Plots a circle. More...
|
|
void | PlotRectangle (double x_left, double y_sup, double x_right, double y_inf, Tplot *p) |
| Plots a rectangle. More...
|
|
void | PlotTriangle (double x1, double y1, double x2, double y2, double x3, double y3, Tplot *p) |
| Plots a triangle. More...
|
|
void | PlotLine (double x0, double y0, double x1, double y1, Tplot *p) |
| Plots a segment. More...
|
|
void | PlotArrow (double x0, double y0, double x1, double y1, Tplot *p) |
| Plots a segment with an arrow. More...
|
|
void | PlotText (double x, double y, const char *text, Tplot *p) |
| Plots a text. More...
|
|
void | PlotAxis (const char *nx, double min_x, double max_x, const char *ny, double min_y, double max_y, double step, Tplot *p) |
| Plots a X-Y axis. More...
|
|
void | ClosePlot (Tplot *p) |
| Destructor. More...
|
|
Dashed line in 2d.
- See Also
- plot.c
Definition at line 35 of file plot.h.
Dotted line in 2d.
- See Also
- plot.c
Definition at line 43 of file plot.h.
void InitPlot |
( |
const char * |
name, |
|
|
Tplot * |
p |
|
) |
| |
void SetLineWidth |
( |
unsigned int |
width, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current line width. It will be used to plot elements from this point on.
- Parameters
-
width | New line width. |
p | The plot to update. |
Definition at line 97 of file plot.c.
References Tplot::line_width.
void SetLineStyle |
( |
unsigned int |
style, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current line style. It will be used to plot elements from this point on.
- Parameters
-
style | New line style. Possible styles are SOLID_LINE, DASHED_LINE, DOTTED_LINE |
p | The plot to update. |
- See Also
- defines.h
Definition at line 105 of file plot.c.
References Tplot::line_style.
Referenced by PlotAxis().
void SetOrigin |
( |
double |
offset_x, |
|
|
double |
offset_y, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current origin of the plot. Elements from now on will be refered to this new origin.
- Parameters
-
offset_x | New offset in x for the origin. |
offset_y | New offset in y for the origin. |
p | The plot to update. |
Definition at line 116 of file plot.c.
References Tplot::offset_x, and Tplot::offset_y.
Referenced by main().
void SetPenColor |
( |
int |
color, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current pen color. Elements from now on will be plotted with this color. Possible colors are:
- -1:default 0:black 1:blue 2:green 3:cyan 4:red 5 magenta 6 yellow 7 white 8 blue4 9 blue3 10 blue2 11 ltblue 12 green4 12 green3 14 green2 15 cyan4 16 cyan3 17 cyan2 18 read4 19 read3 20 read2 21 magenta4 22 magenta3 23 magenta2 24 brown4 25 brown3 26 brown2 27 pink4 28 pink3 29 pink2 30 pink 31 gold.
- Parameters
-
color | The new pen color. |
p | The plot to update. |
Definition at line 122 of file plot.c.
References Tplot::pen_color.
void SetFillColor |
( |
int |
color, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current fill color. Elements from now on will be filled with this color. Possible colors are:
- -1:default 0:black 1:blue 2:green 3:cyan 4:red 5 magenta 6 yellow 7 white 8 blue4 9 blue3 10 blue2 11 ltblue 12 green4 12 green3 14 green2 15 cyan4 16 cyan3 17 cyan2 18 read4 19 read3 20 read2 21 magenta4 22 magenta3 23 magenta2 24 brown4 25 brown3 26 brown2 27 pink4 28 pink3 29 pink2 30 pink 31 gold.
- Parameters
-
color | The new fill color. |
p | The plot to update. |
Definition at line 128 of file plot.c.
References Tplot::fill_color.
void SetFillIntensity |
( |
unsigned int |
intensity, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current fill intensity. Elements from now on will be filled with this intensity. The valid ranges for intensities are [0,20] with 0 no-fill and 20 full_fill.
- Parameters
-
intensity | The new fill intensity. |
p | The plot to update. |
Definition at line 134 of file plot.c.
References Tplot::fill_intensity.
void SetDepth |
( |
unsigned int |
depth, |
|
|
Tplot * |
p |
|
) |
| |
Changes the current plot depth. Elements from now on will be plotted at this depth.
- Parameters
-
depth | The new depth. |
p | The plot to update. |
Definition at line 141 of file plot.c.
References Tplot::depth.
void PlotCircle |
( |
double |
cx, |
|
|
double |
cy, |
|
|
double |
r, |
|
|
Tplot * |
p |
|
) |
| |
Adds a circle to a plot.
- Parameters
-
cx | X coordinate for the center of the circle. |
cy | Y coordinate for the center of the circle. |
r | Radius for the circle. |
p | The plot to update. |
Definition at line 149 of file plot.c.
References CM2POINTS, Tplot::f, PRINTXFIGPREAMBLE, and USER2XFIG.
void PlotRectangle |
( |
double |
x_left, |
|
|
double |
y_sup, |
|
|
double |
x_right, |
|
|
double |
y_inf, |
|
|
Tplot * |
p |
|
) |
| |
void PlotTriangle |
( |
double |
x1, |
|
|
double |
y1, |
|
|
double |
x2, |
|
|
double |
y2, |
|
|
double |
x3, |
|
|
double |
y3, |
|
|
Tplot * |
p |
|
) |
| |
Adds a triangle to a plot.
- Parameters
-
x1 | X coordinate for the first point of the triangle. |
y1 | Y coordinate for the first point of the triangle. |
x2 | X coordinate for the second point of the triangle. |
y2 | Y coordinate for the second point of the triangle. |
x3 | X coordinate for the third point of the triangle. |
y3 | Y coordinate for the third point of the triangle. |
p | The plot to update. |
Definition at line 194 of file plot.c.
References Tplot::f, PRINTXFIGPREAMBLE, and USER2XFIG.
void PlotLine |
( |
double |
x0, |
|
|
double |
y0, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
Tplot * |
p |
|
) |
| |
Adds a segment to a plot.
- Parameters
-
x0 | X coordinate for the origin of the segment. |
y0 | Y coordinate for the origin of the segment. |
x1 | X coordinate for the end of the segment. |
y1 | Y coordinate for the end of the segment. |
p | The plot to update. |
Definition at line 215 of file plot.c.
References Tplot::f, PRINTXFIGPREAMBLE, and USER2XFIG.
Referenced by PlotAxis(), and PlotPolyhedron().
void PlotArrow |
( |
double |
x0, |
|
|
double |
y0, |
|
|
double |
x1, |
|
|
double |
y1, |
|
|
Tplot * |
p |
|
) |
| |
Adds a segment with an arrow at the end to a plot.
- Parameters
-
x0 | X coordinate for the origin of the arrow. |
y0 | Y coordinate for the origin of the arrow. |
x1 | X coordinate for the end of the arrow. |
y1 | Y coordinate for the end of the arrow. |
p | The plot to update. |
Definition at line 227 of file plot.c.
References Tplot::f, PRINTXFIGPREAMBLE, and USER2XFIG.
Referenced by PlotAxis().
void PlotText |
( |
double |
x, |
|
|
double |
y, |
|
|
const char * |
text, |
|
|
Tplot * |
p |
|
) |
| |
Adds a text with to a plot.
- Parameters
-
x | X coordinate for the text. |
y | Y coordinate for the text. |
text | The text to plot. |
p | The plot to update. |
Definition at line 239 of file plot.c.
References Tplot::f, and USER2XFIG.
Referenced by PlotAxis().
void PlotAxis |
( |
const char * |
nx, |
|
|
double |
min_x, |
|
|
double |
max_x, |
|
|
const char * |
ny, |
|
|
double |
min_y, |
|
|
double |
max_y, |
|
|
double |
step, |
|
|
Tplot * |
p |
|
) |
| |
Adds X-Y axis to the plot.
- Parameters
-
nx | Label for the X axis. |
min_x | Value at which the X axis have to start. |
max_x | Value at which the X axis have to end. |
ny | Label for the Y axis. |
min_y | Value at which the Y axis have to start. |
max_y | Value at which the Y axis have to end. |
step | Separation between ticks along the axis. |
p | The plot to update. |
Definition at line 247 of file plot.c.
References PlotArrow(), PlotLine(), PlotText(), SetLineStyle(), and SOLID_LINE.
Referenced by main().
void ClosePlot |
( |
Tplot * |
p | ) |
|
Flushes the information to the output file, closes the file, and frees all the allocated memory for the plot structure.
- Parameters
-
Definition at line 275 of file plot.c.
References Tplot::f.
Referenced by main().
|
Follow us!