Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Tutorial: 2D Special Features

Y Axis Grid Lines
External Y Axis Style
Fill the area between the plot and the axis
Curve Interpolation

Y Axis Grid Lines

If you would like grid lines that go across the graph, you can make the following call to svg_1d_plot:

my_plot.y_major_grid_on(true)
       .y_minor_grid_on(true);

To style it, you would use the following calls:

my_plot.y_major_grid_color(lightgray)
       .y_minor_grid_color(whitesmoke);

This will produce something like the following image:

2d_y_grid

External Y Axis Style

For an alternate way to display a regular axis, you can use an external style:

my_plot.y_external_style_on(true);
[Important] Important

If the axis is turned off, y_external_style_on(true) will not turn the axis back on. To do that, you must call axis_on(true)

Fill the area between the plot and the axis

When there is a call to the plot() method, define _area_fill_color

multimap<double, double> my_data;
svg_2d_plot my_plot;

my_plot.plot(my_data, "Data", _area_fill_color(red));

This produces the following image:

2d_area_fill

Curve Interpolation

If you would like an interpolated curve shown over your data, simply use the following command:

my_plot.plot(data, "Series 1", _bezier_on = "true");

This produces something like the following images:

2d_bezier

[Warning] Warning

The _bezier_curve feature is still very much in its infancy. If you play nice with it, it will play nice with you, but it still displays undesired behavior in extreme circumstances. Do not use this feature with curves that have a limit (-NaN, for example), or with data that has high irregularity in X-Axis spacing (a clump of points between (0, 1) on the X axis, with the next one at 100 on the X axis, for example)

Copyright © 2007 Jake Voytko

PrevUpHomeNext