using m_patch in the m_map package
19 views (last 30 days)
Show older comments
Has anyone used m_coast and m_patch together? They're both functions in the m_map package by Rich Pawlowicz, and there aren't many examples of how to use the m_patch function out there. Here is my code:
figure(1)
hold on
m_proj('miller','lat',[-90,90],'lon',[0,360]);
m_patch(XData,YData,RGBP1,'EdgeColor','none');
m_coast('line','Color','k');
m_grid('xtick',10,'tickdir','out','yaxislocation','left','fontsize',7);
XData is a 4x13824 matrix which specifies the x-coordinates for each patch's verticex, and YData is a 4x13824 matrix with the y-coordinates. Then RGBP1 is a 1x13824x3 matrix which specifies the RGB code for each of the 13824 patches I want.
When I run this I get, the following:
Error using patch
Vectors must be the same length
Error in mu_coast (line 286)
p_hand(i)=patch(xx,yy,varargin{2:end});
Error in m_patch (line 28)
h=mu_coast('vector',[reshape([long;long(1,:);NaN+ones(1,n)],(m+2)*n,1),..
I don't understand what the problem is since all my vectors are the appropriate length. I'd appreciate any help. Thanks!
1 Comment
Jules BASSE
on 17 Nov 2017
Exemple: 18W-10W and 12.5N-17.5N m_proj('miller','lat',[-5,20],'lon',[-30,20]);#west africa area m_coast('line','Color','k'); You create matrix hold on x=[-18 -10 -10 -18];#exemple coord y=[12.5 12.2 17.5 17.5];#exemple coord m_patch(x,y,'black','FaceColor','none')
Answers (0)
See Also
Categories
Find more on Polygons 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!