Skip to content

Ranges

The plotting functions work on any range of elements convertible to double. For instance, we can create a line plot from a set of elements by

1
2
set<int> y = {6,3,8,2,5};
plot(y);

Any object that has the functions begin and end are considered iterable ranges. Most axes object subclasses use vector<double> or vector<vector<double>> to store their data. For convenience, the common.h header file includes the aliases vector_1d and vector_2d to these data types.

These conversions also work on ranges of ranges:

1
2
vector<set<int>> Y = { {6, 3, 8, 2, 5}, {6, 3, 5, 8, 2} };
plot(Y);

Unfortunately, because of how templated functions work, one exception is initializer lists. Initializer lists only work for functions that are explicitly defined for them.