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')
using m_patch in the m_map package
23 次查看(过去 30 天)
显示 更早的评论
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!
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!