How to insert a colorbar to a geobubble
12 ビュー (過去 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
0 件のコメント
採用された回答
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
その他の回答 (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!