change mouse hover datatip information?

15 vues (au cours des 30 derniers jours)
Sven Larsen
Sven Larsen le 3 Mar 2024
Commenté : Sven Larsen le 3 Mar 2024
I have created geoscatter of vehicle speed. When hovering over datapoints on map, datatips show Latitude and Longlitude. How can I change this to show speed?
my code is:
geoscatter(GPSData.latitude, GPSData.longitude, 100, GPSData.speed,'filled');
colormap jet
caxis([0 120]);

Réponse acceptée

Anton Kogios
Anton Kogios le 3 Mar 2024
Since I don't have your GPSData data, here's a working example of how to do it using dataTipTextRow. See also Create Custom Data Tips and DataTipTemplate Properties.
lat = [32.30 33.92 35.17 36.98 37.69 38.34];
lon = [-91.05 -91.18 -90.09 -89.11 -89.52 -90.37];
A = 100*[5 12 15 3 10 3];
C = [1 2 2 3 1 1];
g = geoscatter(lat,lon,A,C,"filled");
g.DataTipTemplate.DataTipRows = dataTipTextRow('Speed',C,'auto');
Otherwise you can also edit individual data tips using:
g.DataTipTemplate.DataTipRows(1).Label = 'Speed';
g.DataTipTemplate.DataTipRows(1).Value = 'SizeData';
g.DataTipTemplate.DataTipRows(1).Format = 'auto';
  1 commentaire
Sven Larsen
Sven Larsen le 3 Mar 2024
marvellous, thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by