How to add a bubble size legend to a geoscatter plot
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Elliot Jenkins
le 16 Jan 2023
Réponse apportée : Trevor
le 19 Jan 2023
I have made a geoscatter plot with parameter 1 being indicated with the colour of the bubble and parameter 2 being indicated by the size of the bubble. I have inserted a colorbar indicating the values for paramater 1. But is there a way I could I add a legend for the size of the bubble on the figure as well or is there a different way to work around the problem?
I just want a way to show the legend for the size of the bubbles as well as the colorbar
s=geoscatter(lat,lon,total,sgi,"filled");
geobasemap streets-dark
geolimits([49.5 60], [-5 -2]);
c.Ticks = [-2 -1.5 -1 0];
clim ([-3 0])
c = colorbar('eastoutside');
c.Label.String = "SGI";
title('Spatial plot of SGI and total drought duration for 1970s')
colormap parula(100);
0 commentaires
Réponse acceptée
Trevor
le 19 Jan 2023
Unfortunately, there isn't a proper way to do this currently.
The main workaround would be to use "geobubble" and split your color data into different groups. "geobubble" shows a legend of the size of the bubble automatically, but it also allows a set of categorical color data and shows a legend of that color data.
This doesn't give you a colorbar, but it does provide a legend on which you can show the ranges of the colors, which may be enough detail depending on your use case. You can name the categories after the sizes of the ranges, and they will appear on the legend.
You can find the documentation for "geobubble" here:
I have also submitted this as an enhancement request so that it can be considered in the future.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Geographic Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!