Creating a scatter plot with three variables.
39 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Brandon Bush
le 5 Juin 2018
Commenté : Star Strider
le 15 Avr 2020
Hello, I am trying to create a scatter plot of some rain gauge data. I have three columns with data in them. My X variable is for Longitude, Y is Latitude and Z would be the rainfall totals. Each variable is a 31x1 double array. How can I get the Z variable to show up as individual points on the graph with color representing higher values?
0 commentaires
Réponse acceptée
Star Strider
le 5 Juin 2018
This uses the value of ‘Z’ to scale the colors:
x = 1:20;
y = 1:20;
[X,Y] = ndgrid(x,y); % Create Grids
Z = (X - 10).*(Y - 10); % Create ‘Z’
figure
scatter3(X(:), Y(:), Z(:), [], Z(:), 'filled') % Use ‘Z(:)’ To Scale Colors
Experiment to get the result you want with your data.
6 commentaires
Plus de réponses (1)
Honglei Chen
le 5 Juin 2018
I would use scatterm, something like
scatterm(X,Y,5,Z)
The reference page can be found at
HTH
2 commentaires
Voir également
Catégories
En savoir plus sur Scatter 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!