How to use "hold", or similar function, with Geobubble?
5 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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
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)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Geographic Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!