1234567891011121314151617181920 |
- #include "../matplotlibcpp.h"
- namespace plt = matplotlibcpp;
- int main()
- {
- // u and v are respectively the x and y components of the arrows we're plotting
- std::vector<int> x, y, u, v;
- for (int i = -5; i <= 5; i++) {
- for (int j = -5; j <= 5; j++) {
- x.push_back(i);
- u.push_back(-i);
- y.push_back(j);
- v.push_back(-j);
- }
- }
- plt::quiver(x, y, u, v);
- plt::show();
- }
|