How to use "hold", or similar function, with Geobubble?

5 ビュー (過去 30 日間)
Xel Ch
Xel Ch 2018 年 7 月 23 日
回答済み: Mohammad Sami 2020 年 6 月 1 日
Hello, I am trying to use the function geobubble multiple times in the same code to allow for different colors and sizes of bubbles on my map. To do so, I am trying to put the statement "hold on" between runs of geobubble, but am given the error, "Using hold with geobubble is not supported."
Another way I tried to solve this was by setting the map to parent axes with the statement "AxesH = axes('NextPlot', 'add');" at the beginning of the code. But, this gave me the error, "GeographicBubbleChart cannot be a child of Axes."
I am using Matlab2018A if it makes a difference. Any tips or alternate ways to approach this would be greatly appreciated. Thank you.
for ii = 2017:2018
T = readtable('RealQuakes5.xls');
TT = T(T.Year == ii,:)
figure
AxesH = axes('NextPlot', 'add');
TT.MagnitudeCat = discretize(TT.Magnitude,-2:1:10,'categorical');
gb = geobubble(TT,2,3,'SizeVariable','Magnitude','ColorVariable','MagnitudeCat','Basemap','colorterrain','Parent', AxesH);
geolimits([36 50],[-82, -56])
gb.BubbleColorList = flipud(autumn(12));
default_width_range = gb.BubbleWidthRange;
gb.BubbleWidthRange = [1 20];
hold on
gb = geobubble(TT,2,3,'SizeVariable','Magnitude','ColorVariable','MagnitudeCat','Basemap','colorterrain','Parent', AxesH);
geolimits([36 50],[-82, -56])
gb.BubbleColorList = flipud(autumn(12));
default_width_range = gb.BubbleWidthRange;
gb.BubbleWidthRange = [1 20];
title(ii)
end
  2 件のコメント
zhang bo
zhang bo 2020 年 3 月 18 日
編集済み: zhang bo 2020 年 3 月 19 日
figure;
geoaxes('NextPlot','add');
geoplot(x1,y1);
geoscatter(x2,y2,V,C,'fill');
BN
BN 2020 年 6 月 1 日
It's not working. This is my question too. Anybody knows the answer? I want plot a border around country

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

回答 (1 件)

Mohammad Sami
Mohammad Sami 2020 年 6 月 1 日
geobubble allows for size and color to be specified as variables. You can concatenate your data in one table, and use the size and color variables instead for your need.
geobubble(lat,lon,sizedata,colordata)

カテゴリ

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