forked from alandefreitas/matplotplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheatmap_5.cpp
31 lines (28 loc) · 986 Bytes
/
heatmap_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
#include <matplot/matplot.h>
int main() {
using namespace matplot;
std::vector<std::vector<double>> data = {
{12, 135, 20, 0, 127},
{0, 1, 0, 0, 1},
{19, 31, 81, 8, 49},
{9, 18, 42, 2, 85},
{0, 5, 3, 0, 17},
{31, 143, 135, 6, 23},
{32, 102, 54, 6, 7},
{5, 11, 4, 0, 4},
{16, 41, 13, 3, 22},
{18, 70, 37, 1, 19}
};
heatmap(data);
title("Count of Cause vs. Region");
auto ax = gca();
ax->x_axis().ticklabels({"MidWest", "NorthEast", "SouthEast", "SouthWest", "West"});
ax->y_axis().ticklabels({"Attack", "Earthquake", "Energy emergency", "Equipment fault", "Fire", "Severe Storm", "Thunder Storm", "Unknown", "Wind", "Winter Storm"});
xlabel(ax, "Region");
ylabel(ax, "Cause");
double w = ax->width();
ax->width(w*0.85);
ax->x_origin(ax->x_origin() + w * 0.1);
wait();
return 0;
}