Skip to content

Commit e42df5d

Browse files
Merge pull request #148 from matthew-hennefarth/vector-colormap-normalize
Quiver/Quiver3 Colormap and Normalize
2 parents ff5c42a + cca45ca commit e42df5d

File tree

16 files changed

+965
-133
lines changed

16 files changed

+965
-133
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,4 @@ if (BUILD_INSTALLER AND BUILD_PACKAGE)
128128

129129
# Always include CPack at last
130130
include(CPack)
131-
endif ()
131+
endif ()

README.md

Lines changed: 26 additions & 1 deletion
Large diffs are not rendered by default.

docs/examples/vector_fields/quiver/quiver_6.svg

Lines changed: 144 additions & 0 deletions
Loading
11.8 KB
Loading

docs/examples/vector_fields/quiver3/quiver3_2.svg

Lines changed: 309 additions & 0 deletions
Loading
12.5 KB
Loading

examples/vector_fields/quiver/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ add_executable(example_quiver_5 quiver_5.cpp)
1414
target_link_libraries(example_quiver_5 PUBLIC matplot)
1515

1616

17+
add_executable(example_quiver_6 quiver_6.cpp)
18+
target_link_libraries(example_quiver_6 PUBLIC matplot)
1719

examples/vector_fields/quiver/quiver_4.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ int main() {
1717

1818
show();
1919
return 0;
20-
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <cmath>
2+
#include <matplot/matplot.h>
3+
4+
int main() {
5+
using namespace matplot;
6+
auto [x, y] = meshgrid(iota(-2.5, 0.25, 2.5), iota(-2.5, 0.25, 2.5));
7+
vector_2d u =
8+
transform(x, y, [](double x, double y) { return cos(x) * sin(x + y); });
9+
vector_2d v =
10+
transform(x, y, [](double x, double y) { return sin(y) * cos(x + y); });
11+
12+
vector_2d m =
13+
transform(u, v, [](double u, double v) { return sqrt(u * u + v * v); });
14+
15+
quiver(x, y, u, v, m, 0.2)->normalize(true).line_width(1.5);
16+
17+
colormap(palette::jet());
18+
show();
19+
return 0;
20+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_executable(example_quiver3_1 quiver3_1.cpp)
22
target_link_libraries(example_quiver3_1 PUBLIC matplot)
33

4-
4+
add_executable(example_quiver3_2 quiver3_2.cpp)
5+
target_link_libraries(example_quiver3_2 PUBLIC matplot)
56

0 commit comments

Comments
 (0)