using m_patch in the m_map package

조회 수: 25 (최근 30일)
Sylvia
Sylvia 2014년 9월 29일
댓글: Jules BASSE 2017년 11월 17일
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
Jules BASSE
Jules BASSE 2017년 11월 17일
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')

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by