Geobubble with specifing radius and discretize

조회 수: 5 (최근 30일)
Rachele Franceschini
Rachele Franceschini 2022년 7월 21일
댓글: Adam Danz 2022년 7월 21일
I have this script to get a Geobubble, but I have two problems. I would like to get bubbles with specifing radius, on the base of count (see sequence if)...And the second problem is discretize, I recived one error. How can I do?
lat = coordinate.latitudine; %latitude
lon = coordinate.longitudine; %longitude
count = coordinate.count; %count
%if count is less of 5 the radius of bubbles have to be of 5 etc
if count < 5
r=5;
elseif count < 15
r=15;
elseif count < 257
r=45;
end
gb.SourceTable.Severity = discretize(coordinate.count,[0 10 50 500],...
'categorical', {'Low', 'Medium', 'High'});
gb.ColorVariable = 'Severity';
%in this section I have this error: Error using matlab.graphics.chart.GeographicBubbleChart/set.SourceTable
%Setting the 'SourceTable' property after setting the 'LatitudeData' property is not supported.
The I put these properties
gb.BubbleColorList = winter(3);
gb=geobubble(lat,lon,count)
gb.Basemap = 'grayterrain'
gb.BubbleColorList = winter(3);
gb.SizeLegendTitle='count'
gb.BubbleWidthRange=[5 20]
gb.Title='Geobubbles'
gb.FontSize=16
gb.MapLayout='normal'

답변 (1개)

Adam Danz
Adam Danz 2022년 7월 21일
The sizedata argument in geobubble determines the relative sizes of the bubbles. If you want to specify the absolute size of the bubbles, I recommend using geoscatter instead. The 3rd argument in geoscatter specifiies the area of the scatter points which you can compute from you desired radii values.
  댓글 수: 2
Rachele Franceschini
Rachele Franceschini 2022년 7월 21일
I have resolved in this way:
lat = coordinateeff1119count.latitudine_eff;
lon = coordinateeff1119count.longitudine_eff;
count = coordinateeff1119count.created_at;
%this part have been added
count(count<18)=5;
count(5<count & count<56)=18
count(18<count & count<320)=45
gb=geobubble(coordinateeff1119count,'latitudine_eff','longitudine_eff', 'SizeVariable','created_at')
gb.Basemap = 'grayterrain'
Adam Danz
Adam Danz 2022년 7월 21일
I see. So, you didn't want to specify the radii. Instead, this specifies the relative sizes of the bubbles.
Glad you worked it out!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by