Stipple hatch on a Arctic map isn't showed correctly
조회 수: 7 (최근 30일)
이전 댓글 표시
Hello! I'm using m_map toolbox and stipple function from Climate Data Toolbox to create an Arctic map with spatial correlation. I ran into problem that stipple hatch looks more like a line than a stipple closer to a pole. How can that be solved? Image is attached. My code looks like this:
[latp,lonp] = meshgrid(lat,new_lon);
figure
m_proj('stereographic','lat',90,'long',-360,'radius',23)
hold on
[CS,CH]=m_contourf(new_lon,lat,corr_sc_sh_w',[-1:.04:1],'edgecolor','none');
axb=m_contfbar([.3 .7],-.025,CS,CH,'endpiece','no');
axb.FontSize = 12;
axb.XLabel.String = 'correlation coef';
m_coast('line','color','#414141','linewi',1)
m_grid('xtick',12,'tickdir','out','ytick',[70 75 80 85 90],'yticklabels',[],'linest','--','color','#414141');
colormap(cmocean('balance','pivot',0))
hold on
[x,y]=m_ll2xy(lonp,latp);
stipple(x,y,mask,'density',1000,'markersize',3)
title('DJFM SiConc-SH','fontsize',16,'Position',[0, 0.43, 0]);
댓글 수: 0
채택된 답변
Austin M. Weber
2024년 2월 20일
Since your chart is shown using a stereographic projection, the stipple marks closest to the pole only appear like a line. This is because the distance between longitudinal coordinates decreases as you move poleward, and so the stipples are essentially being plotted on top of one another.
One potential way to resolve this would be to decrease the 'density' name-value pair and/or the marker size for your chart:
stipple(x, y, mask, 'density', 500, 'markersize', 2)
Alternatively, if you don't want to apply those changes to the entire figure, you can try making an index for all the stipple marks above 70 degrees N latitude and then plot those values separately from the stipple marks at lower latitudes, but with a different density and marker size.
stipple(x_below70, y_below70, mask_below70, 'density', 1000, 'markersize',3)
stipple(x_above70, y_above70, mask_above70, 'density', 500, 'markersize',2)
If neither of these options work, consider attaching a .mat file containing your data (or a fake dataset with a similar issue) and then either myself or another one of the volunteers can try to figure things out on your behalf.
추가 답변 (1개)
Anna
2024년 2월 21일
댓글 수: 1
Austin M. Weber
2024년 2월 21일
@Anna, I'm glad you have found a solution! Packaging everything into a function is a good idea.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!