Azzera filtri
Azzera filtri

How to insert a colorbar to a geobubble

7 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Yang
Yang il 7 Giu 2022
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 Commenti
TESFALEM ALDADA
TESFALEM ALDADA il 14 Giu 2022
Dear Yand,
Ya it worked well. thank you with great appreciation
TESFALEM ALDADA
TESFALEM ALDADA il 14 Giu 2022
Dear Yang,
Ya it worked well. thank you with great appreciation

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Geographic Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by