Austin Schuh | ab802d5 | 2020-07-03 18:11:11 -0700 | [diff] [blame] | 1 | #include "../matplotlibcpp.h" |
| 2 | |
| 3 | #include <cmath> |
| 4 | |
| 5 | namespace plt = matplotlibcpp; |
| 6 | |
| 7 | int main() |
| 8 | { |
| 9 | std::vector<std::vector<double>> x, y, z; |
| 10 | for (double i = -5; i <= 5; i += 0.25) { |
| 11 | std::vector<double> x_row, y_row, z_row; |
| 12 | for (double j = -5; j <= 5; j += 0.25) { |
| 13 | x_row.push_back(i); |
| 14 | y_row.push_back(j); |
| 15 | z_row.push_back(::std::sin(::std::hypot(i, j))); |
| 16 | } |
| 17 | x.push_back(x_row); |
| 18 | y.push_back(y_row); |
| 19 | z.push_back(z_row); |
| 20 | } |
| 21 | |
| 22 | plt::plot_surface(x, y, z); |
| 23 | plt::show(); |
| 24 | } |