How to specify line color using a hexadecimal color code
Afficher commentaires plus anciens
Hi,
why the plot function return an error message when I specify the color as a hexadecimal color code i.e
x = linspace(-2*pi,2*pi);
y = sin(x);
plot( x , y , 'Color' , '#FF0000' )
Error using plot
Specified character vector is an invalid color value.
Réponse acceptée
Plus de réponses (2)
Subrata Paul
le 30 Juil 2019
4 votes
You can also use some color :
Matlab plotting colors
The following are the letters you can add to your code to control the color of your plot while plotting in Matlab.
- b blue
- g green
- r red
- c cyan
- m magenta
- y yellow
- k black
- w white
. point
o circle
x x-mark
+ plus
* star
s square
d diamond
v triangle (down)
^ triangle (up)
< triangle (left)
> triangle (right)
p pentagram
h hexagram
— dashed
-. dashdot
: dotted
– solid
Link: https://tutorial45.com/matlab-plot-colors-and-styles/
Subrata Paul
le 30 Juil 2019
0 votes
Thanks
Catégories
En savoir plus sur Contour 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!