Dash Quiver Plot

I’m attempting to create a quiver plot in Dash. It seem that in Plotly, this is normally done with the FigureFactory. Is this possible to replicate in Dash?

Yup! Pretty similar call signature. The fig that any of the plotly.figure_factory functions returns can be used directly in the dash_core_components.Graph(figure=fig) component. Here’s a simple example:

import dash
import plotly.plotly as py
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)

app = dash.Dash()

app.layout = html.Div([
    html.H3('Quiver Plot'),
    dcc.Graph(id='quiver', figure=fig)
])
1 Like