why does not MATLAB print/save properly?

I have developed a very straightforward MATLAB code whose sets the background color of the plot to 'blue' and the color of the line to 'white':
x=-10:10;
y=x.^2;
figPath='C:\test.jpg';
% plotting the figure
hFig=figure('PaperType','A4');
line(x,y,'color','w');
box off;
set(gca,'Color','b') ; %color of the area behind the plot
print(hFig,'-djpeg','-r600',figPath);
but what is printed is different from what I have already set, I mean the color of the area behind the plot is white (I set it to blue in my code) and the color of line is black while I set it to white in the code.
I would be grateful if anybody could help me to resolve the problem.
Many thanks in advance, _V

 채택된 답변

Walter Roberson
Walter Roberson 2012년 10월 11일

0 개 추천

See the figure property InvertHardcopy

댓글 수: 1

Vahid
Vahid 2012년 10월 12일
편집: Walter Roberson 2012년 10월 12일
thanks a lot!
figure('InvertHardcopy','off');

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2012년 10월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by