jupyter |
jupytext |
kernelspec |
language_info |
plotly |
notebook_metadata_filter |
text_representation |
all |
extension |
format_name |
format_version |
jupytext_version |
.md |
markdown |
1.1 |
1.2.3 |
|
|
display_name |
language |
name |
Python 3 |
python |
python3 |
|
codemirror_mode |
file_extension |
mimetype |
name |
nbconvert_exporter |
pygments_lexer |
version |
|
.py |
text/x-python |
python |
python |
ipython3 |
3.7.3 |
|
description |
display_as |
language |
layout |
name |
order |
permalink |
thumbnail |
How to make a quiver plot in Python. A quiver plot displays velocity vectors a arrows. |
scientific |
python |
base |
Quiver Plots |
11 |
python/quiver-plots/ |
thumbnail/quiver-plot.jpg |
|
|
import plotly.figure_factory as ff
import numpy as np
x,y = np.meshgrid(np.arange(0, 2, .2), np.arange(0, 2, .2))
u = np.cos(x)*y
v = np.sin(x)*y
fig = ff.create_quiver(x, y, u, v)
fig.show()
import plotly.figure_factory as ff
import plotly.graph_objects as go
import numpy as np
x,y = np.meshgrid(np.arange(-2, 2, .2),
np.arange(-2, 2, .25))
z = x*np.exp(-x**2 - y**2)
v, u = np.gradient(z, .2, .2)
# Create quiver figure
fig = ff.create_quiver(x, y, u, v,
scale=.25,
arrow_scale=.4,
name='quiver',
line_width=1)
# Add points to figure
fig.add_trace(go.Scatter(x=[-.7, .75], y=[0,0],
mode='markers',
marker_size=12,
name='points'))
fig.show()
Cone plot for the 3D equivalent of quiver plots.