Generates a quiver plot colored according to vector magnitude and/or user specified axis boundaries.
Updated 6 Mar 2015

View License

quiverwcolorbar adds functionality to the original quiver function by assigning color to the arrows according to the vector magnitude. The corresponding colorbar spans the minimum and maximum values of the dataset or can be specified by the user. Any changes to the colorbar boundaries change the vector colors accordingly.
quiverwcolorbar(x,y,u,v,scale,'bounds',[colormin colormax])

x, y: Vector locations
u, v: Vector directions (East-West, North-South)
scale: Scalar value to set vector lengths
'bounds': Optional setting to specify colorbar axis minimum and maximum values

x = rand(1,50).*100;
y = rand(1,50).*100;
u = rand(1,50) .* 10;
v = rand(1,50) .* 10;
scale = 0;
figure; quiverwcolorbar(x',y',u',v',scale); %compare to:
figure; quiverwcolorbar(x',y',u',v',scale,'bounds',[0 10]);

Cite As

Melissa Day (2024). quiverwcolorbar (https://www.mathworks.com/matlabcentral/fileexchange/40224-quiverwcolorbar), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Vector Fields in Help Center and MATLAB Answers

Inspired by: Quiverc, quiverc2wcmap, vfield_color, quiver2.m v1.2 (Nov 2009)

Inspired: quivermc

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Fixed so scale can be used to change arrow size

Minor typo fixes

Fixed some typos, added bit in case min(xyuvvrNNs) < colormin

changed spacing in description

Fixed some typos, added bit in case min(xyuvvrNNs) < colormin