Skip to content

Commit 0b11a50

Browse files
committed
add a 4th example to create_quiver to showcase the new param.
1 parent c065497 commit 0b11a50

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Diff for: plotly/figure_factory/_quiver.py

+23
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ def create_quiver(x, y, u, v, scale=.1, arrow_scale=.3,
8383
# Add title to layout
8484
fig['layout'].update(title='Quiver Plot')
8585
86+
# Plot
87+
py.plot(fig, filename='quiver')
88+
```
89+
90+
Example 4: Forcing a fix scale ratio to maintain the arrow length
91+
```
92+
import plotly.plotly as py
93+
from plotly.figure_factory import create_quiver
94+
95+
import numpy as np
96+
97+
# Add data
98+
x,y = np.meshgrid(np.arange(0.5, 3.5, .5), np.arange(0.5, 4.5, .5))
99+
u = x
100+
v = y
101+
angle = np.arctan(v / u)
102+
norm = 0.25
103+
u = norm * np.cos(angle)
104+
v = norm * np.sin(angle)
105+
106+
# Create quiver with a fix scale ratio
107+
fig = create_quiver(x, y, u, v, scale = 0.75, scaleratio = 0.5)
108+
86109
# Plot
87110
py.plot(fig, filename='quiver')
88111
```

0 commit comments

Comments
 (0)