Setting scatter point color when scattering matrices instead of vectors.
Afficher commentaires plus anciens
I am doing a scatter plot with two matrices with each row being a custom color based on a colormap.
scatter(x,y) works fine, x and y are both 3982x100, but my color vector is 3982x1.
scatter(x,y,[],c) gives me an error
Error using scatter (line 61)
Color must be one RGB triplet, an m-by-3 matrix of RGB triplets with one color per scatter point, or an
m-by-1 vector with one value per scatter point.
Convering my color vector c into a 3982x100 matrix doesn't work and gives the same error. Using reshape to turn a 3982x100 color matrix into a 398200 column vector also doesn't work even though it is an m by 1 vector with a value for each of my scatter points.
How can I make each row it's own color? I really don't want to make a for loop since it is 3982 separate plots to make.
EDIT: I realize now that I can reshape the input matrices, but I feel like there should still be a better way to do this.
The simplified question is
scatter([1,2;3,4],[1,2;3,4],[],[5;5;5;5])
why doesn't this work? I have 4 scatter points and a 4 element color vector.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Scatter Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
