フィルターのクリア

How to insert a colorbar to a geobubble

7 ビュー (過去 30 日間)
TESFALEM ALDADA
TESFALEM ALDADA 2022 年 5 月 30 日
コメント済み: TESFALEM ALDADA 2022 年 6 月 14 日
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 Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by