In [1]:
#include "xplot/xfigure.hpp"
#include "xplot/xmarks.hpp"
#include "xplot/xaxes.hpp"
In [2]:
std::vector<double> x_data{1, 2, 3, 4, 5, 6, 7};
std::vector<std::vector<double>> y_data = {
{160.10, 162.34, 161.82, 162.24, 161.44, 158.51, 157.68, 151.93, 151.41, 153.06, 155.38, 161.07, 160.51, 162.99, 161.86, 163.27, 164.05, 164.52, 162.67},
{161.54, 162.17, 161.95, 161.76, 162.15, 160.92, 160.64, 161.43, 161.89, 164.16, 164.16, 162.79, 161.92, 163.30, 163.49, 162.07, 161.46, 161.82, 162.65},
{164.40, 164.35, 163.46, 163.60, 161.87, 162.08, 162.18, 161.79, 163.23, 169.10, 182.05, 179.84, 181.75, 183.80, 183.52, 185.93, 186.42, 189.36, 185.71},
{188.67, 186.91, 187.17, 189.83, 189.64, 190.06, 189.01, 192.31, 191.62, 193.11, 194.00, 193.75, 192.80, 192.96, 191.81, 191.28, 191.72, 191.20, 190.68},
{191.95, 191.56, 192.30, 192.00, 192.25, 192.99, 191.16, 190.41, 191.23, 190.10, 190.07, 189.36, 187.38, 187.88, 191.81, 191.28, 191.72, 189.99, 190.14},
{187.95, 187.34, 187.47, 186.63, 184.30, 185.97, 187.10, 189.64, 189.15, 191.67, 194.00, 194.57, 195.78, 194.40, 195.24, 193.63, 190.85, 192.5, 192.49},
{192.36, 188.49, 189.86, 188.00, 187.70, 188.42, 187.22, 188.04, 188.53, 188.39, 186.35, 181.27, 181.71, 180.37, 180.72, 180.88, 182.14, 181.55, 182.82}
};
In [3]:
xpl::linear_scale xs, ys;
In [4]:
auto boxplot = xpl::boxplot_generator(xs, ys)
.x(x_data)
.y(y_data)
.box_fill_color("gray")
.outlier_fill_color("black")
.finalize();
In [5]:
xpl::axis hx(xs);
hx.label = "X";
In [6]:
auto hy = xpl::axis_generator(ys)
.label("Y")
.orientation("vertical")
.tick_format("0.1f")
.finalize();
In [7]:
xpl::figure fig;
fig.add_mark(boxplot);
fig.add_axis(hx);
fig.add_axis(hy);
fig.display()
In [8]:
boxplot.stroke = "red";
boxplot.box_fill_color = "blue";
boxplot.outlier_fill_color = "red";
In [9]:
boxplot.opacities = std::vector<double>{0.1, 0.2};
In [ ]: