Skip to content

Commit c1ad253

Browse files
alexdewarlava
authored andcommitted
Add example of quiver plot
1 parent 697054c commit c1ad253

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

examples/quiver.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "../matplotlibcpp.h"
2+
3+
namespace plt = matplotlibcpp;
4+
5+
int main()
6+
{
7+
// u and v are respectively the x and y components of the arrows we're plotting
8+
std::vector<int> x, y, u, v;
9+
for (int i = -5; i <= 5; i++) {
10+
for (int j = -5; j <= 5; j++) {
11+
x.push_back(i);
12+
u.push_back(-i);
13+
y.push_back(j);
14+
v.push_back(-j);
15+
}
16+
}
17+
18+
plt::quiver(x, y, u, v);
19+
plt::show();
20+
}

examples/quiver.png

38.8 KB
Loading

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy