필터 지우기
필터 지우기

graphing colors

조회 수: 2 (최근 30일)
Andy
Andy 2011년 10월 11일
this is the code i have:
plot(all_conflims_mult, 'linestyle', '--', 'color', [0.00 0.00 1.00], 'linewidth', thick)
instead of having 'color', [0.00 0.00 1.00]
i would like to just 'g' or 'r' (For green and red) instead of the 3 numbers, how would i do that? THanks

채택된 답변

Micah
Micah 2011년 10월 11일
You can use the few matlab built in colors ('red','green,'blue,'black','white','cyan','magenta','yellow'),
plot(...,'color','green',...)
but you could also just declare a variable that is that vector, i.e.
g = [0 0 1]
plot(...,'color',g,...)

추가 답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 10월 11일
or:
plot(x,y,'g');
and
doc linespec
for a full list of predefined colors.

Laura Proctor
Laura Proctor 2011년 10월 11일
You need to have the letter for the color in single quotes. Or, you can specify using linespec:
plot(1:10,'--b')
Also note that LineWidth must be a number:
plot(1:10,'LineStyle','--','Color','b','LineWidth',4)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by