FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/plot_types/arrays/streamplot.py at pre-commit · ianhi/matplotlib · GitHub
ianhi
matplotlib
Repository navigation
Code
Pull requests
5
(5)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
plot_types
/
arrays
/
streamplot.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (19 loc) · 546 Bytes
Breadcrumbs
matplotlib
/
plot_types
/
arrays
/
streamplot.py
Copy path
File metadata and controls
25 lines (19 loc) · 546 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
======================
streamplot(X, Y, U, V)
======================
See `~matplotlib.axes.Axes.streamplot`.
"""
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
plt
.
style
.
use
(
'_mpl-gallery-nogrid'
)
# make a stream function:
X
,
Y
=
np
.
meshgrid
(
np
.
linspace
(
-
3
,
3
,
256
),
np
.
linspace
(
-
3
,
3
,
256
))
Z
=
(
1
-
X
/
2
+
X
**
5
+
Y
**
3
)
*
np
.
exp
(
-
X
**
2
-
Y
**
2
)
# make U and V out of the streamfunction:
V
=
np
.
diff
(
Z
[
1
:, :],
axis
=
1
)
U
=
-
np
.
diff
(
Z
[:,
1
:],
axis
=
0
)
# plot:
fig
,
ax
=
plt
.
subplots
()
ax
.
streamplot
(
X
[
1
:,
1
:],
Y
[
1
:,
1
:],
U
,
V
)
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL