How to use "hold", or similar function, with Geobubble?
조회 수: 4 (최근 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!