Skip to content

Commit df521fc

Browse files
committed
Add 3d example with no default colorbox
1 parent 494acab commit df521fc

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

examples/data_distribution/scatter3/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ target_link_libraries(example_scatter3_5 PUBLIC matplot)
1515

1616
add_executable(example_scatter3_6 scatter3_6.cpp)
1717
target_link_libraries(example_scatter3_6 PUBLIC matplot)
18+
19+
add_executable(example_scatter3_7 scatter3_7.cpp)
20+
target_link_libraries(example_scatter3_7 PUBLIC matplot)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <matplot/matplot.h>
2+
#include <random>
3+
4+
int main() {
5+
using namespace matplot;
6+
7+
gcf()->quiet_mode(true);
8+
auto z = linspace(0., 4. * pi, 250);
9+
auto x = transform(z, [](double z) { return 2 * cos(z) + rand(0, 1); });
10+
auto y = transform(z, [](double z) { return 2 * sin(z) + rand(0, 1); });
11+
12+
std::vector<double> sizes(x.size(), 5);
13+
std::vector<double> colors(x.size() / 2, 1);
14+
std::fill_n(std::back_inserter(colors), x.size() / 2, 2);
15+
16+
scatter3(x, y, z, sizes, colors, "filled");
17+
colormap(palette::paired());
18+
19+
gca()->visible(false);
20+
view(-30, 10);
21+
22+
show();
23+
return 0;
24+
}

0 commit comments

Comments
 (0)