-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
67c2d84
commit 4d69553
Showing
4 changed files
with
1,798 additions
and
1,798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#include \"xwidgets/xhtml.hpp\"\n", | ||
"\n", | ||
"#include \"xleaflet/xmap.hpp\"\n", | ||
"#include \"xleaflet/xmarker.hpp\"\n", | ||
"\n", | ||
"auto html = xw::html::initialize()\n", | ||
" .value(\"Hello from an <b>xwidget</b> in an <b>xmarker</b>!\")\n", | ||
" .finalize();\n", | ||
"\n", | ||
"std::array<double, 2> center = {52.204793, 360.121558};\n", | ||
"\n", | ||
"auto map = xlf::map::initialize()\n", | ||
" .center(center)\n", | ||
" .zoom(15)\n", | ||
" .finalize();\n", | ||
"\n", | ||
"auto marker = xlf::marker::initialize()\n", | ||
" .location(center)\n", | ||
" .draggable(false)\n", | ||
" .popup(html)\n", | ||
" .finalize();\n", | ||
"map.add_layer(marker);\n", | ||
"\n", | ||
"map" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "C++14", | ||
"language": "C++14", | ||
"name": "xeus-cling-cpp14" | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#include \"xwidgets/xhtml.hpp\"\n", | ||
"\n", | ||
"#include \"xleaflet/xmap.hpp\"\n", | ||
"#include \"xleaflet/xmarker.hpp\"\n", | ||
"\n", | ||
"auto html = xw::html::initialize()\n", | ||
" .value(\"Hello from an <b>xwidget</b> in an <b>xmarker</b>!\")\n", | ||
" .finalize();\n", | ||
"\n", | ||
"std::array<double, 2> center = {52.204793, 360.121558};\n", | ||
"\n", | ||
"auto map = xlf::map::initialize()\n", | ||
" .center(center)\n", | ||
" .zoom(15)\n", | ||
" .finalize();\n", | ||
"\n", | ||
"auto marker = xlf::marker::initialize()\n", | ||
" .location(center)\n", | ||
" .draggable(false)\n", | ||
" .popup(html)\n", | ||
" .finalize();\n", | ||
"map.add_layer(marker);\n", | ||
"\n", | ||
"map" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "C++14", | ||
"language": "C++14", | ||
"name": "xeus-cling-cpp14" | ||
}, | ||
"language_info": { | ||
"version": "14", | ||
"codemirror_mode": "text/x-c++src", | ||
"file_extension": ".cpp", | ||
"mimetype": "text/x-c++src", | ||
"name": "c++" | ||
} | ||
}, | ||
"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 | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#include <algorithm>\n", | ||
"#include <random>\n", | ||
"#include <vector>\n", | ||
"\n", | ||
"#include \"xplot/xfigure.hpp\"\n", | ||
"#include \"xplot/xmarks.hpp\"\n", | ||
"#include \"xplot/xaxes.hpp\"\n", | ||
"\n", | ||
"auto randn(std::size_t n)\n", | ||
"{\n", | ||
" std::vector<double> output(n);\n", | ||
" std::random_device rd;\n", | ||
" std::mt19937 gen(rd());\n", | ||
" std::normal_distribution<> dis(5, 2);\n", | ||
"\n", | ||
" std::for_each(output.begin(), output.end(), [&dis, &gen](auto& v){v = dis(gen);});\n", | ||
"\n", | ||
" return output;\n", | ||
"}\n", | ||
"\n", | ||
"std::size_t data_size = 200;\n", | ||
"std::vector<double> data_x(data_size);\n", | ||
"std::iota(data_x.begin(), data_x.end(), 0);\n", | ||
"std::vector<double> data_y = randn(data_size);\n", | ||
"std::vector<double> data_c = randn(data_size);\n", | ||
"\n", | ||
"xpl::linear_scale scale_x, scale_y;\n", | ||
"xpl::linear_scale scale_size;\n", | ||
"\n", | ||
"auto scatter = xpl::scatter::initialize(scale_x, scale_y, scale_size)\n", | ||
" .x(data_x)\n", | ||
" .y(data_y)\n", | ||
" .size(data_c)\n", | ||
" .stroke(\"black\")\n", | ||
" .default_size(128)\n", | ||
" .enable_move(true)\n", | ||
" .colors(std::vector<xtl::xoptional<std::string>>{\"orangered\"})\n", | ||
" .finalize();\n", | ||
"\n", | ||
"xpl::axis axis_x(scale_x), axis_y(scale_y);\n", | ||
"axis_x.label = \"x\";\n", | ||
"axis_y.label = \"y\";\n", | ||
"axis_y.orientation = \"vertical\";\n", | ||
"axis_y.side = \"left\";\n", | ||
"\n", | ||
"xpl::figure fig;\n", | ||
"fig.padding_x = 0.025;\n", | ||
"fig.add_mark(scatter);\n", | ||
"fig.add_axis(axis_x);\n", | ||
"fig.add_axis(axis_y);\n", | ||
"fig" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "C++14", | ||
"language": "C++14", | ||
"name": "xeus-cling-cpp14" | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#include <algorithm>\n", | ||
"#include <random>\n", | ||
"#include <vector>\n", | ||
"\n", | ||
"#include \"xplot/xfigure.hpp\"\n", | ||
"#include \"xplot/xmarks.hpp\"\n", | ||
"#include \"xplot/xaxes.hpp\"\n", | ||
"\n", | ||
"auto randn(std::size_t n)\n", | ||
"{\n", | ||
" std::vector<double> output(n);\n", | ||
" std::random_device rd;\n", | ||
" std::mt19937 gen(rd());\n", | ||
" std::normal_distribution<> dis(5, 2);\n", | ||
"\n", | ||
" std::for_each(output.begin(), output.end(), [&dis, &gen](auto& v){v = dis(gen);});\n", | ||
"\n", | ||
" return output;\n", | ||
"}\n", | ||
"\n", | ||
"std::size_t data_size = 200;\n", | ||
"std::vector<double> data_x(data_size);\n", | ||
"std::iota(data_x.begin(), data_x.end(), 0);\n", | ||
"std::vector<double> data_y = randn(data_size);\n", | ||
"std::vector<double> data_c = randn(data_size);\n", | ||
"\n", | ||
"xpl::linear_scale scale_x, scale_y;\n", | ||
"xpl::linear_scale scale_size;\n", | ||
"\n", | ||
"auto scatter = xpl::scatter::initialize(scale_x, scale_y, scale_size)\n", | ||
" .x(data_x)\n", | ||
" .y(data_y)\n", | ||
" .size(data_c)\n", | ||
" .stroke(\"black\")\n", | ||
" .default_size(128)\n", | ||
" .enable_move(true)\n", | ||
" .colors(std::vector<xtl::xoptional<std::string>>{\"orangered\"})\n", | ||
" .finalize();\n", | ||
"\n", | ||
"xpl::axis axis_x(scale_x), axis_y(scale_y);\n", | ||
"axis_x.label = \"x\";\n", | ||
"axis_y.label = \"y\";\n", | ||
"axis_y.orientation = \"vertical\";\n", | ||
"axis_y.side = \"left\";\n", | ||
"\n", | ||
"xpl::figure fig;\n", | ||
"fig.padding_x = 0.025;\n", | ||
"fig.add_mark(scatter);\n", | ||
"fig.add_axis(axis_x);\n", | ||
"fig.add_axis(axis_y);\n", | ||
"fig" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "C++14", | ||
"language": "C++14", | ||
"name": "xeus-cling-cpp14" | ||
}, | ||
"language_info": { | ||
"version": "14", | ||
"codemirror_mode": "text/x-c++src", | ||
"file_extension": ".cpp", | ||
"mimetype": "text/x-c++src", | ||
"name": "c++" | ||
} | ||
}, | ||
"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 | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.