Clear Filters
Clear Filters

Stipple hatch on a Arctic map isn't showed correctly

17 views (last 30 days)
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]);

Accepted Answer

Austin M. Weber
Austin M. Weber on 20 Feb 2024
Hi @Anna,
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 Comment
Anna
Anna on 21 Feb 2024
Thanks for the answer, but it still isn't looking enough pretty for me. I'll try to reduce the discreteness of the xy coordinates from the 75N, perhaps it'll work.

Sign in to comment.

More Answers (1)

Anna
Anna on 21 Feb 2024
So I figured out changing the discreteness of lon coordinates, then interpolate array with p-value into new grid. The code looks like this:
border = 75;
latb1 = lat(lat<border);
latb2 = lat(lat>=border);
disc = 1.05;
[latp72,lonp72] = meshgrid(latb1,new_lon);
[latp73,lonp73] = meshgrid(latb2,new_lon(1):disc:new_lon(end));
[x_below72,y_below72]=m_ll2xy(lonp72,latp72);
[x_above72,y_above72]=m_ll2xy(lonp73,latp73);
mask2 = griddata(lat,new_lon,pval_sc_sh_w2,latp73,lonp73);
then the stipple part looks like this:
hold on
stipple(x_below72,y_below72,pval_sc_sh_w2(:,lat<border)<0.05,'density',450,'markersize',6.5)
stipple(x_above72,y_above72,mask2<0.05,'density',250,'markersize',6.5)
The parameteres can be changed in the future, but in overall it looks much better. Thanks @Austin M. Weber for the useful hint with setting up a border! I'm thinking about making the function that creates the cleanest look for the stipple in stereo projection
  1 Comment
Austin M. Weber
Austin M. Weber on 21 Feb 2024
@Anna, I'm glad you have found a solution! Packaging everything into a function is a good idea.

Sign in to comment.

Categories

Find more on Climate Science and Analysis 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!