![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205364/image.jpeg)
how to represent the purple color by a string value
328 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
There are 8 colors that can be specified by a string value: 'r','g','b','c','m','y','k','w'.
How to specify the maroon,olive,purple color by a string value.
0 commentaires
Réponses (1)
John D'Errico
le 22 Fév 2019
Modifié(e) : John D'Errico
le 22 Fév 2019
You can't. MATLAB offers those string options for colors. If you want to set a specific color, you can, but as a numeric vector of length 3. You need to provide RGB code values.
For example, for a purple of sorts, you might do this:
H = surf(rand(10));
H.FaceColor = [.5 0 .5];
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205364/image.jpeg)
Not my favorite color scheme, but it is purple. And, for an olive, you might try something like this:
H.FaceColor = [.3 .4 .2];
You get the idea.
0 commentaires
Voir également
Catégories
En savoir plus sur Startup and Shutdown 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!