Coastlines not showing up when using worldmap with specified lat and long

2 ビュー (過去 30 日間)
Maren Hale
Maren Hale 2021 年 6 月 24 日
I am trying to make a map centered on the San Diego county region, which shows the coastline and my datapoints. I am using scatterm to show the datapoints so I can have their values represented by the color of the point. Everything is working fine except the coastlines aren't showing up on the figure. I am not even getting any error messages, the line just doesn't show up (some of my points are directly on the coast so I know it's missing).
Here is my code:
WiSuCorrelationLats = [32.8663;32.7338;32.6997;32.8921;32.628208;32.885847;33.081050;32.901867;32.729578;33.268447];
WiSuCorrelationLongs = [-117.2546;-117.1993;-117.1830;-117.1310;-116.93928;-117.14314;-116.9757;-117.25046;-117.13934;-116.36505];
figure
worldmap([32.60 33.28],[-117.38 -116.85])
plotm(coastlat,coastlon)
scatterm(WiSuCorrelationLats,WiSuCorrelationLongs,25,WinterSummerSSTCorrelations.("Corr. w/ SST (Winter)"),'filled')
title('Correlations with SST (Winter)')
colorbar
caxis([0.5 1])
Oddly enough, I think this has something to do with the second line, where I specify the lat and long within the worldmap function, because when I try specifying worldmap("United States") instead of worldmap([32.60 33.28],[-117.38 -116.85]) the coastlines actually do show up on the figure. Unfortunately, I don't want a view of the entire US, I want a zoomed in view of just this region.
Here's the code using the entire US, which does produce a map with coastlines:
figure
load coastlines
worldmap("United States")
plotm(coastlat,coastlon)
scatterm(WiSuCorrelationLats,WiSuCorrelationLongs,25,WinterSummerSSTCorrelations.("Corr. w/ SST (Winter)"),'filled')
colorbar
caxis([0.5 1])
Am I missing something about how worldmap or coastlines works? Can you only view coastlines at a certain distance or something?

回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by