필터 지우기
필터 지우기

How to add color to plot/graph

조회 수: 1 (최근 30일)
Chuzymatics Chuzymatics
Chuzymatics Chuzymatics 2014년 9월 14일
편집: Mischa Kim 2014년 9월 14일
Hi everybody! Please How can I color the background of the plot generated by the code below:
clf
x=[0:pi/6:2*pi];
deg = x.*180/pi;
y = sind(deg) -cosd(deg);
plot(deg,y, '-dc', 'lineWidth', 2);
xlabel('Angle in degrees')
ylabel('Amplitude')
title('Graph of y(x) = sind(deg) -cosd(deg)')
set(gca, 'linewidth', 2)
legend('sind(deg)-cosd(deg)')
%grid

채택된 답변

Mischa Kim
Mischa Kim 2014년 9월 14일
편집: Mischa Kim 2014년 9월 14일
Something like
whitebg([r g b])
where r g b are the RGB values of the color, e.g.,
whitebg([1 0 0])
for red. Alternatively, you could use
set(gca,'Color',[r g b])
to only color the plot background.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by