forked from alandefreitas/matplotplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binscatter_5.cpp
47 lines (36 loc) · 1.09 KB
/
binscatter_5.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <matplot/matplot.h>
#include <random>
#include <tuple>
int main() {
using namespace matplot;
auto f = figure(true);
f->width(f->width() * 2);
f->height(f->height() * 2);
f->x_position(200);
f->y_position(100);
f->quiet_mode(true);
auto x = randn(10000, 0., 1.);
auto y = randn(10000, 0., 1.);
subplot(2, 3, 0);
scatter(x, y);
title("Scatter plot");
subplot(2, 3, 1);
binscatter(x, y, 30, 10, bin_scatter_style::point_size);
title("Binned scatter plot: Point size");
subplot(2, 3, 2);
binscatter(x, y, 30, 10, bin_scatter_style::point_alpha);
title("Binned scatter plot: Point alpha");
subplot(2, 3, 3);
binscatter(x, y, 30, 10, bin_scatter_style::jitter);
title("Binned scatter plot: Jitter");
subplot(2, 3, 4);
binscatter(x, y, 30, 10, bin_scatter_style::point_colormap);
title("Binned scatter plot: Colormap");
subplot(2, 3, 5);
binscatter(x, y, 30, 10, bin_scatter_style::heatmap);
title("Binned scatter plot: Heatmap");
axis(tight);
f->draw();
show();
return 0;
}