How to insert a colorbar to a geobubble

12 visualizaciones (últimos 30 días)
TESFALEM ALDADA
TESFALEM ALDADA el 30 de Mayo de 2022
Comentada: TESFALEM ALDADA el 14 de Jun. de 2022
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

Respuesta aceptada

Yang
Yang el 7 de Jun. de 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 comentarios
TESFALEM ALDADA
TESFALEM ALDADA el 14 de Jun. de 2022
Dear Yand,
Ya it worked well. thank you with great appreciation
TESFALEM ALDADA
TESFALEM ALDADA el 14 de Jun. de 2022
Dear Yang,
Ya it worked well. thank you with great appreciation

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Geographic Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by