MATLAB plot line color setting

MATLAB plot line color setting The color of the line in the
plot is usually eight:
marker color
r red
g green
b blue
c blue green
m purple red
y yellow
k black
w white

However, the color of the line is composed of three primary colors of red, green and blue (RGB). The color of the line can be changed by setting the weight of the three primary colors. The command is as follows (x is the abscissa, y is the ordinate): 
The domain value of color is 0-1 
plot(x,y,'Color',[1 0 0]);represents red
plot(x,y,'Color',[0 1 0]);represents green
plot(x,y,'Color',[0 0 1]); represents blue 
plot(x, y, 'Color', [0.3 0.8 0.9]); is a new color composed of three colors.
When you need colors other than the eight commonly used ones above, you can get different colors as long as you set the RGB value in the color.

For example, draw a blue x-line:
plot(x,y,'bg')
drawing:
line: - solid line -. dotted line - long dashed line: short dashed line
Symbol color Symbol Line shape
b blue . point
c green . Circle
g green × × mark
k black - solid line
m magenta * asterisk
r red : dotted line
w white -. dotted line
y yellow - dotted line
———————————————
Copyright Disclaimer: This article is an original article by CSDN blogger "jirryzhang" and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/jirryzhang/article/details/77374702

 

1. Line type

'-' Solid line '--' Dashed line ':' Dotted line '-.' Dotted line

's' or square plot each data point as a square 'p' Pentagram 'd' or diamond 'h' Hexagon

'.' Plot each data point with a dot number '^' Plot each data point with an upper triangle

'+' draw each data point with a '+' sign 'v' draw each data point with a lower triangle

'*' Use the '*' sign to draw each data point'>' Use the right triangle to draw each data point

' .' Plot each data point with a '.' sign '<' Plot each data point with a left triangle

2. Color

'r' red 'm' pink 'g' green 'c' cyan 'b' blue 'w' white 'y' yellow 'k' black

plot(t,y,'-bs','LineWidth',2,... % Set the line width to 2

                   'MarkerEdgeColor','k',... % Set the marker edge color to black

                   'MarkerFaceColor','y',... % Set the marker fill color to yellow

                   'MarkerSize',10) % Set the size/size of the marker to 10
 

3. Line width

plot(i3,Global_opt_R1,'-r', i3,Global_opt_R2,'--b',i3,Global_opt_R3,'--b','linewidth',1.5)

4. Coordinate setting

set(gca,'fontsize',8);%set the axis font size
set(gca,'linewidth',0.5);%coordinate line thickness 0.5 points

set(get(gca,'XLabel'),'FontSize',8);% The text on the picture is 8 points or a small 5 size
set(get(gca,'YLabel'),'FontSize',8);
set(get (gca,'TITLE'),'FontSize',8);
———————————————
Copyright notice: This article is an original article by CSDN blogger "ma123rui", following CC 4.0 BY -SA copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/ma123rui/article/details/100591182

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324143334&siteId=291194637