필터 지우기
필터 지우기

How do I set a background Color in Plots?

조회 수: 314 (최근 30일)
Sridhar N
Sridhar N 2014년 11월 7일
답변: Kherbache Abdelkader 2021년 5월 22일
Hi , I wanted to know as to how I can go about changing the background color in a plot. The default background color of a plot is White. Some info on how to keep the color of data points' constant and change only background color of plot will be of great help. Thanks !

답변 (3개)

Star Strider
Star Strider 2014년 11월 7일
The patch function is one way to do it:
x = linspace(0,10*pi);
y = sin(x).*cos(50*x);
xl = [min(x) max(x)];
yl = [min(y) max(y)];
figure(1)
patch([xl fliplr(xl)], [yl(1) yl(1) yl(2) yl(2)], [0.5 0.8 0.9])
hold on
plot(x, y, '-b')
grid
hold off
axis([min(x) max(x) min(y) max(y)])

Stalin Samuel
Stalin Samuel 2014년 11월 7일
figure('Color',[0.8 0.8 0.8]); set(gca, 'color', [1 1 0])

Kherbache Abdelkader
Kherbache Abdelkader 2021년 5월 22일
set(gca,'color', [0.8 0.8 0.8]);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by