In [1]:
#include "random.hpp"
#include "xplot/xfigure.hpp"
#include "xplot/xmarks.hpp"
#include "xplot/xaxes.hpp"
In [2]:
std::size_t size = 10;
In [3]:
std::vector<double> x(size);
std::iota(x.begin(), x.end(), 0);
std::vector<double> y = randn(size);
In [4]:
xpl::ordinal_scale xs;
xpl::linear_scale ys;
xpl::bars bar(xs, ys);
bar.x = x;
bar.y = y;
bar.padding = 0.5;
In [5]:
xpl::figure fig;
fig.add_mark(bar);
fig.display()
In [6]:
xpl::axis hx(xs), hy(ys);
hy.orientation = "vertical";
fig.add_axis(hx);
fig.add_axis(hy);
In [7]:
std::vector<double> opacities(10);
std::fill(opacities.begin(), opacities.end(), 0.5);
In [8]:
bar.opacities = opacities;
In [9]:
bar.colors = std::vector<std::string>({"blue"});
In [ ]: