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

조회 수: 4 (최근 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 CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by