フィルターのクリア

Error using geobasemap in subplot

23 ビュー (過去 30 日間)
Sagar Parajuli
Sagar Parajuli 2023 年 7 月 26 日
コメント済み: Cris LaPierre 2023 年 7 月 26 日
I am trying to plot some geolocated data with geoscatter as below:
geobasemap grayterrain
geolimits([35.79 40],[-124.8552 -119.3342]);
geoscatter(lat_stn, lon_stn, data_sum, data_sum, 'filled');
clim([0, 80]);
colorbar;
The above code works perfectly well and plots the data in a given basemap.
However, when I try to plot the exact above thing in a subplot I get some errors:
subplot (1, 2, 2)
geobasemap grayterrain
geolimits([35.79 40],[-124.8552 -119.3342]);
geoscatter(lat_stn, lon_stn, data_sum, data_sum, 'filled');
clim([0, 80]);
colorbar;
The error I get is:
Error using geobasemap>parseInputs
Unable to use geobasemap. Current axes or chart is not geographic.
Error in geobasemap (line 30)
[gx, basemap, usingBasemapSyntax] = parseInputs(varargin);
Error in spatial_madis_model_comparison_geobubble (line 94)
geobasemap grayterrain
Could you please advise how to fix this issue?

回答 (1 件)

Cris LaPierre
Cris LaPierre 2023 年 7 月 26 日
編集済み: Cris LaPierre 2023 年 7 月 26 日
subplot creates a cartesian axes in the current position. Since you call geobasemap and geolimits before geoscatter, they attemp to operate on the cartesian axes, which is not allowed.
Try changing the order of your code so that you call geoscatter first, which does create a geographic axes, and then geolimits and geobasemap
subplot(1,2,2)
lat = [42.3501 42.3598 42.3626 42.3668 42.3557];
lon = [-71.0870 -71.0662 -71.0789 -71.0801 -71.0662];
geoscatter(lat,lon,"filled")
geolimits([42.3456 42.3694],[-71.0930 -71.0536])
geobasemap grayterrain
clim([0, 80]);
colorbar;
  4 件のコメント
Sagar Parajuli
Sagar Parajuli 2023 年 7 月 26 日
So you mean there is no solution to this? I can query the geolimits used but the limits that I specified are not working, that is my problem. I read that there is a 'manual' mode for geolimits but that stil doesn't allow to specify the limits.
Cris LaPierre
Cris LaPierre 2023 年 7 月 26 日
This is the documented behavior of geolimits.
The geolimits function typically uses wider limits than the limits you specify to maintain the aspect ratio of the map.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by