How to insert a colorbar to a geobubble

7 次查看(过去 30 天)
I wanted to show a colorbar to the geobubble created for a certain dataset. The code provided below shows only the legend however, when i try adding a colorbar it doesnot add.
gauged_cat = readtable('gaugedQ1.xlsx');
gauged_cat.AreaKM2 = categorical(gauged_cat.AreaKM2);
gb = geobubble(gauged_cat,'LAT','LON','ColorVariable','AreaKM2');
gb.BubbleColorList = flipud(copper(12)); % for coloring
geolimits([2 18],[33 50])
I need the colorbar of AreaKM2 from the minimum to the maximum range but the legend shows all the points. Any one who can show me how it works is highly appreaciated.
Thank you

采纳的回答

Yang
Yang 2022-6-7
Hi,
You may use geoscatter instead, and then add colorbar.
gauged_cat = readtable('gaugedQ1.xlsx');
A = 30; % marker size
C = gauged_cat.AreaKM2; % marker color
geoscatter(gauged_cat.LAT, gauged_cat.LON, A, C,'filled','MarkerEdgeColor','w');
colormap(flipud(copper));
geolimits([2 18],[33 50]);
cbh = colorbar;
cbh.Title.String = "Area (km^2)";
cbh.Ruler.Exponent = 0;
More details of geoscatter can be found in the documentation at this link: https://www.mathworks.com/help/matlab/ref/geoscatter.html
  2 个评论
TESFALEM ALDADA
TESFALEM ALDADA 2022-6-14
Dear Yand,
Ya it worked well. thank you with great appreciation
TESFALEM ALDADA
TESFALEM ALDADA 2022-6-14
Dear Yang,
Ya it worked well. thank you with great appreciation

请先登录,再进行评论。

更多回答(0 个)

类别

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