{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#include \"random.hpp\"\n", "#include \"xplot/xfigure.hpp\"\n", "#include \"xplot/xmarks.hpp\"\n", "#include \"xplot/xaxes.hpp\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "std::size_t size = 10;" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "std::vector x(size);\n", "std::iota(x.begin(), x.end(), 0);\n", "std::vector y = randn(size);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "xpl::ordinal_scale xs;\n", "xpl::linear_scale ys;\n", "xpl::bars bar(xs, ys);\n", "bar.x = x;\n", "bar.y = y;\n", "bar.padding = 0.5;" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "xpl::figure fig;\n", "fig.add_mark(bar);\n", "fig" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "xpl::axis hx(xs), hy(ys);\n", "hy.orientation = \"vertical\";\n", "fig.add_axis(hx);\n", "fig.add_axis(hy);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "std::vector opacities(10);\n", "std::fill(opacities.begin(), opacities.end(), 0.5);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.opacities = opacities;" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "bar.colors = std::vector({\"blue\"});" ] } ], "metadata": { "kernelspec": { "display_name": "C++14", "language": "C++14", "name": "xeus-cling-cpp14" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".cpp", "mimetype": "text/x-c++src", "name": "c++", "version": "14" } }, "nbformat": 4, "nbformat_minor": 2 }