Streamline Plots in MATLAB®

How to make Streamline Plots plots in MATLAB® with Plotly.


Draw Streamlines

Define arrays x, y, u, and v.

[x,y] = meshgrid(0:0.1:1,0:0.1:1);
u = x;
v = -y;

Create a quiver plot of the data. Plot streamlines that start at different points along the line y=1.

[x,y] = meshgrid(0:0.1:1,0:0.1:1);
u = x;
v = -y;

figure
quiver(x,y,u,v)

startx = 0.1:0.1:1;
starty = ones(size(startx));
streamline(x,y,u,v,startx,starty)

fig2plotly(gcf);
load wind
zmax = max(z(:)); zmin = min(z(:));
streamslice(x,y,z,u,v,w,[],[],(zmax-zmin)/2)

p = plotlyfig(gcf);

for d = 1:length(p.data)
  p.data{d}.type = 'scatter'; 
end

p.plotly;

Streamline Plot Styling

Edit, style, save, and export this streamline plot online:
https://plotly.com/9526/~jackp/