How to plot fewer arrows and increase their size on a quiver plot that is merged over another field?

73 views (last 30 days)
I am merging 3 fields together (land/ocean, pressure field and velocity field).
I manage to align all the fields together but I can't find a way to reduce the number of arrows I am plotting on my quiver plot. I also want to increase the size of my arrows. When I tried to plot only 1/4 of the quiver's arrows, the quiver plot disappeared. See the commented line above.
I have attached my data as "data2.mat".
Here is my code:
load('data2.mat');
figure(1)
ax1 = axes;
pcolor(Land);
axis ij;
axis equal;
box on;
axis off;
shading flat;
ax2 = axes;
hold on;
pcolor(XERAmat,YERAmat, mslpPosMask);
contour(XERAmat,YERAmat, mslpPosMask,'k','LevelList',...
min(mslpPosMask,[],'all') - rem(min(mslpPosMask,[],'all'),1):1:...
max(mslpPosMask,[],'all') + (1 - rem(max(mslpPosMask,[],'all'),1)),'ShowText','on');
axis ij;
axis equal;
box on;
axis off;
shading flat;
ax3 = axes;
id = 4 ; % plot every 4th value
h2 = quiver(Upos,Vpos,'k');
%I try to plot fewers arrows and increase the size of the arrows
%h2 = quiver(Upos(1:id:end,1:id:end),Vpos(1:id:end,1:id:end),'k');
set(h2,'AutoScale','on', 'AutoScaleFactor', 5)
axis ij;
axis equal;
box on;
axis off;
shading flat;
%%Link axes together
linkaxes([ax1,ax2,ax3])
%%Hide the top axes
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
%%Give each one its own colormap
colormap(ax1,cmap)
colormap(ax2,'parula')
%%Then add colorbars and get everything lined up
cb2 = colorbar(ax2,'Position',[0.8 0.11 0.05 0.815]);
ylabel(cb2,'sea level pressure (hPa)','Fontsize',18);
xlim([110 270]);
ylim([70 260]);
My actual figure:
I want my quiver plot to look more something like this:
Thank you

Answers (1)

MJFcoNaN
MJFcoNaN on 7 Apr 2022
Edited: MJFcoNaN on 7 Apr 2022
You may try this code:
id = 8 ; % plot every 4th value
ScaleFactor = 10;
Upos0 = Upos;
Vpos0 = Vpos;
Upos = NaN(size(Upos0));
Vpos = NaN(size(Vpos0));
Upos(1:id:end, 1:id:end)=Upos0(1:id:end, 1:id:end);
Vpos(1:id:end, 1:id:end)=Vpos0(1:id:end, 1:id:end);
h2 = quiver(Upos,Vpos,'k');
%I try to plot fewers arrows and increase the size of the arrows
%h2 = quiver(Upos(1:id:end,1:id:end),Vpos(1:id:end,1:id:end),'k');
set(h2,'AutoScale','on', 'AutoScaleFactor', ScaleFactor)
  3 Comments
A LL
A LL on 7 Apr 2022
I ended up converting everthing on a lat/lon grid and using quivermc instead of quiver. Thank you for your time.

Sign in to comment.

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by