Streamline plot with color gradient

Hi there,

I know it is possible to make nice streamline plots, but I was wondering how to add a color gradient the same way matplotlib does (see attached pic)?



Hi @Alexboiboi,

This isn’t possible at the moment, but it would be a great addition. Feel free to open a feature request at to discuss.


Hi @jmmease,

I just found a work around to make this ‘partially’ work. The only thing it’s missing is the ability to apply a color scale to a line chart (which is still an open issue, see

import plotly.graph_objs as go
import plotly.figure_factory as ff
from scipy.interpolate import RegularGridInterpolator
import numpy as np

x = np.linspace(-3, 3, 100)
y = np.linspace(-3, 3, 100)
Y, X = np.meshgrid(x, y)
u = -1 - X**2 + Y
v = 1 + X - Y**2

# Create streamline figure
ff_fig = ff.create_streamline(x, y, u, v, arrow_scale=.1)
fig = go.FigureWidget(ff_fig)
t =[0]

def f(x,y):
    return np.sin(x)*np.cos(y)

data = f(*np.meshgrid(x, y, indexing='ij'))
my_interpolating_function = RegularGridInterpolator((x, y), data)

pts= np.array([t.x,t.y]).T

colors = my_interpolating_function(np.nan_to_num(pts))

t.marker.color = colors