Effacer les filtres
Effacer les filtres

How to make scatter points into squares of a given size?

39 vues (au cours des 30 derniers jours)
Robert Wu
Robert Wu le 15 Déc 2017
Commenté : Walter Roberson le 15 Déc 2017
I would like to make a figure where my data points 'c' are squares of a given size instead of points.
The problem with the scatter function is that the points are too small. Making them larger will result in the data points overlaping.
x = (1:121);
y = zeros(1,121);
c = rand(1,121);
scatter(x,y,20,c)
Any help would be appreciated.
Many thanks,
Rob.

Réponses (1)

Walter Roberson
Walter Roberson le 15 Déc 2017
Modifié(e) : Walter Roberson le 15 Déc 2017
scatter(x, y, c, 'Marker', 's')
Note: Many readers would tend to associate the variable name 'c' with "color", but you are using it in a position associated with marker size.
  2 commentaires
Robert Wu
Robert Wu le 15 Déc 2017
Modifié(e) : Robert Wu le 15 Déc 2017
Hi Walter,
Thanks for the reply. The 'c' variable is color. I want to represent the value of my data with color. I used rand in this case for the sake of the question.
Walter Roberson
Walter Roberson le 15 Déc 2017
scatter(x, y, [], c, 'Marker', 's')
The order is x, y, size, color, then property/value pairs.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Discrete Data 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!

Translated by