In [1]:
#include "xplot/xfigure.hpp"
#include "xplot/xmarks.hpp"
#include "xplot/xaxes.hpp"
In [2]:
std::size_t n = 1000;
In [3]:
#include <random>
std::random_device rd;
std::mt19937 gen(rd());
std::normal_distribution<> d(5,2);
In [4]:
std::vector<double> y(n);
In [5]:
for(std::size_t i=0; i<n; ++i)
y[i] = d(gen);
In [6]:
xpl::linear_scale xs, ys;
xpl::hist hist(xs, ys);
hist.sample = y;
In [7]:
xpl::figure fig;
fig.add_mark(hist);
fig.display()
In [8]:
xpl::axis hx(xs), hy(ys);
hy.orientation = "vertical";
fig.add_axis(hx);
fig.add_axis(hy);
In [9]:
hist.colors = std::vector<std::string>{"blue"};
In [ ]: