이 코드변경 matlab에 배경 색상
1 function makegraph(A,B)
2 results=load(A);
3 time = results(:,3) - 1238370000;
4 firstTimeIndex = find(time >= (max(time) - 86400*7), 1);
5 results = results(max(1,firstTimeIndex-1):end, :);%Results now only containe s data from the last week
6 temp = results(:,3)-1238370000;
7 h=plot(temp,smooth(results(:,1)),':b','linewidth',2)
8 ylim([0 80])
9 xlim([max(temp)-(86400*7),max(temp)-1])
10 set(gca,'color','black')
11 set(gcf,'color','black') %get's rid of he axis alltogether
12 hold on
13 plot(temp, smooth(results(:,4)), 'r', 'linewidth', 2);
14 plot(temp, smooth(results(:,5)), 'g', 'linewidth', 2);
15 plot(temp, smooth(results(:,6)), 'm', 'linewidth', 2);
16 xlim([max(temp)-(86400*7),max(temp)-1])
17 set(gca,'XTick',[1:86400:(max(temp))+1])
18 set(gca,'XTickLabel',['Mon';'Tue';'Wed';'Thu';'Fri';'Sat';'Sun'])
19 print('-djpeg',B)
20 hold off
파일 이름을 'B'에서이 그래프를 저장합니다 ...
그것은 잘 작동하지만 내가 다른 컨텍스트에 넣어 싶습니다, 있는 나는 내림차순으로
set(gca,'color',[1 1 0])
set(gcf,'color',[1 1 0])
설정을 시도
... 그것은 검은 배경이 필요 Setting the background color of a plot in MATLAB using the command line?
에 의해 ribed 내가
whitebg(1,'k')
을 시도했습니다 ... 그리고 내가 갈 곳없는거야 -particualarly 때문에 가끔 시도하고
세트 (GCA들과 함께 놀 때, ' color ','black ') (gcf,'color ','black ') 설정을 적용하면 일부 플롯이 사라집니다.
나는 몹시 혼란 스럽다. 누군가 Setting the background color of a plot in MATLAB using the command line?에서 받아 들여지는 대답이 왜 여기에서 작동하지 않는지를 말해 줄 수 있었 을까? ...?
B는 무엇입니까? matlab에 표시된 그림이나 인쇄 된 파일에만이 문제가 있습니까? – Molly
gca \ gcf를 사용하는 대신 figure \ axes의 핸들을 직접 사용해보십시오. –
@Molly B는 파일 이름입니다. - 편집 한 파일 - 인쇄 된 파일을보고 있습니다 ... 어떤 도움이 되었습니까? 그것... – Joe