Skip to content

Commit af0edb5

Browse files
committed
- Added Eigen availability check in distplot.cpp
- updated .gitignore to ignore build folder
1 parent 03daf57 commit af0edb5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ zmq/*
66
*.obj
77
*.html
88
*.ruleset
9-
*.gif
9+
*.gif
10+
build/*

examples/for_seaborn/distplot.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
#include <random>
55
#include <numeric>
66

7-
#include <Eigen/Eigen/Core>
8-
97
/*
108
* Uncomment seaborn imports in cppyplot_server.py for this example to work
119
*/
@@ -15,7 +13,6 @@ int main()
1513
{
1614
Cppyplot::cppyplot pyp;
1715

18-
Eigen::Matrix<double, 5000, 2> mat;
1916
std::vector<std::vector<double>> rand_mat (5000, std::vector<double>(2));
2017
std::random_device seed;
2118
std::mt19937 gen(seed());
@@ -28,7 +25,9 @@ int main()
2825
{ elem = norm(gen); }
2926
}
3027

28+
#ifdef EIGEN_AVAILABLE
3129
// fill eigen matrix
30+
Eigen::Matrix<double, 5000, 2> mat;
3231
for (auto& row: mat.rowwise())
3332
{
3433
for (auto& elem : row)
@@ -48,6 +47,7 @@ int main()
4847
plt.title("Numpy type slicing on C++ Eigen matrix", fontsize=14)
4948
plt.show(block=False)
5049
)pyp", _p(mat));
50+
#endif
5151

5252
// Using 2D std-vector
5353
pyp.raw(R"pyp(
@@ -58,7 +58,7 @@ int main()
5858
plt.grid(True)
5959
plt.xlabel("X", fontsize=12)
6060
plt.ylabel("Y", fontsize=12)
61-
plt.title("Numpy type slicing on C++ 2D vector", fontsize=14)
61+
plt.title("2D distribution plotting with seaborn", fontsize=14)
6262
plt.show()
6363
)pyp", _p(rand_mat));
6464

0 commit comments

Comments
 (0)