Skip to content

Commit

Permalink
add a 4th example to create_quiver to showcase the new param.
Browse files Browse the repository at this point in the history
  • Loading branch information
dabana committed Sep 24, 2018
1 parent c065497 commit ee40b82
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions plotly/figure_factory/_quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,29 @@ def create_quiver(x, y, u, v, scale=.1, arrow_scale=.3,
# Add title to layout
fig['layout'].update(title='Quiver Plot')
# Plot
py.plot(fig, filename='quiver')
```
Example 4: Forcing a fix scale ratio to maintain the arrow length
```
import plotly.plotly as py
from plotly.figure_factory import create_quiver
import numpy as np
# Add data
x,y = np.meshgrid(np.arange(0.5, 3.5, .5), np.arange(0.5, 4.5, .5))
u = x
v = y
angle = np.arctan(v / u)
norm = 0.25
u = norm * np.cos(angle)
v = norm * np.sin(angle)
# Create quiver with a fix scale ratio
fig = create_quiver(x, y, u, v, scale = 1, scaleratio = 0.5)
# Plot
py.plot(fig, filename='quiver')
```
Expand Down

0 comments on commit ee40b82

Please sign in to comment.