In [1]:
#include "random.hpp"
#include "xplot/xfigure.hpp"
#include "xplot/xmarks.hpp"
#include "xplot/xaxes.hpp"
#include "xplot/xtoolbar.hpp"
In [2]:
std::size_t size = 100;
std::vector<double> x_data(size);
std::iota(x_data.begin(), x_data.end(), 0);
std::vector<double> y_data = randn(size);
In [3]:
xpl::linear_scale xs, ys;
xpl::scatter scatter(xs, ys);
In [4]:
scatter.x = x_data;
scatter.y = y_data;
In [5]:
xpl::axis ax_x(xs), ax_y(ys);
ax_y.orientation = "vertical";
In [6]:
xpl::figure fig;
fig.padding_x = 0.025;
fig.add_mark(scatter);
fig.add_axis(ax_x);
fig.add_axis(ax_y);
fig.padding_y = 0.025;
In [7]:
xpl::toolbar toolbar(fig);
In [8]:
#include "xwidgets/xbox.hpp"
In [9]:
xw::vbox b;
In [10]:
b.add(fig);
In [11]:
b.add(toolbar);
In [12]:
b.display()
In [15]:
fig.animation_duration = 1000;
In [17]:
scatter.x = randn(size);
scatter.y = randn(size);
In [ ]: