Draw direction arrows on top of wind magnitude time series.

4 views (last 30 days)
Hello,
Dispite several tries I cannot generate a figure like this.
I would appriciate any help.

Accepted Answer

Steven Lord
Steven Lord on 17 Jan 2019
Do you want to overlay a quiver plot on top of a regular line plot? If so, call hold on after creating the first plot but before creating the second so the first isn't erased when the second is drawn.
  2 Comments
khem gautam
khem gautam on 22 Jan 2019
Dear Steven, thank you for replying.
As far as I understood quiver is a 2D plot, what I wanted is more like feather but the directions should start at each points of the line. The plot I am drawing is a plot of wind magnitute with wind directions. I wanted to plot directional arrows at the points where I plot the magnitute. The arrow length (for me) does not matter but its direction does.
I solved my problem partly by using arrow.m from file exchange but still it is too slow!
Steven Lord
Steven Lord on 22 Jan 2019
This sample data doesn't look so great, but hopefully it will be sufficient to illustrate the technique. x and y are the coordinates of the points on your line.
x = 1:40;
y = 3*rand(size(x));
plot(x, y, '-');
hold on;
offsetx and offsety are the lengths of the arrows in the x and y directions.
offsetx = 2*rand(size(x)) - 1;
offsety = 2*rand(size(x)) - 1;
I use the fifth input argument of quiver to disable the automatic scaling and plot the arrows going directly from the point (x(k), y(k)) to (x(k)+offsetx(k), y(k)+offsety(k)) for each k.
quiver(x, y, offsetx, offsety, 0)

Sign in to comment.

More Answers (0)

Categories

Find more on Weather and Atmospheric Science in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!