forked from lava/matplotlib-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspy.cpp
More file actions
30 lines (24 loc) · 605 Bytes
/
spy.cpp
File metadata and controls
30 lines (24 loc) · 605 Bytes
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
#include "../matplotlibcpp.h"
#include <iostream>
#include <vector>
namespace plt = matplotlibcpp;
int main()
{
const int n = 20;
std::vector<std::vector<double>> matrix;
for (int i = 0; i < n; ++i) {
std::vector<double> row;
for (int j = 0; j < n; ++j) {
if (i == j)
row.push_back(-2);
else if (j == i - 1 || j == i + 1)
row.push_back(1);
else
row.push_back(0);
}
matrix.push_back(row);
}
plt::spy(matrix, 5, {{"marker", "o"}});
plt::show();
return 0;
}