필터 지우기
필터 지우기

plotting figures - pixel depth

조회 수: 1 (최근 30일)
Diego
Diego 2012년 12월 4일
Dear all,
How can I improve my figures in order to avoid the pixelation when zooming in them?
I'm using this function for creating the figures (mostly automatically generated by matlab) but I couldn't obtain the desired results.
I have tried maximizing the window, but I don't like the proportions of the text regarding the figure.
Thanks in advance,
Diego
function createfigure(A, B, C)
%CREATEFIGURE(A,B,C)
% A: vector of x data
% B: vector of y data
% C: table name
% Auto-generated by MATLAB on 04-Dec-2012 03:52:43
% screen_size = get(0, 'ScreenSize');
% Create figure
figure1 = figure;
% set(figure1, 'Position', [0 0 screen_size(3) screen_size(4) ] );
% Create axes
axes1 = axes('Parent',figure1,'YGrid','on','XGrid','on');
box(axes1,'on');
hold(axes1,'all');
% Create title
disp(inputname(1))
t = ({[C{1}, ' - ', inputname(2), ' vs. ', inputname(1) ]});
title(t)
% Create plot
plot(A,B,'Marker','.','LineStyle','none',...
'DisplayName', {[inputname(2) ' vs. ' inputname(1)]});
% Create xlabel
xlabel(inputname(1));
% Create ylabel
ylabel(inputname(2));
X=getframe(gcf);
imwrite(X.cdata, [C{1}, '_', inputname(2), '_vs_', inputname(1),'.png'])
  댓글 수: 1
Diego
Diego 2012년 12월 4일
Well, figures look a lot better changing the last command to saveas:
% imwrite(X.cdata, [C{1}, '_', inputname(2), '_vs_', inputname(1),'.png'])
saveas(gcf, [C{1}, '_', inputname(2), '_vs_', inputname(1),'.png'])
I'm still interested in improving the appearance of my figures, so any advice is welcome...

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

채택된 답변

Wouter
Wouter 2012년 12월 4일
편집: Wouter 2012년 12월 4일
You could give this a try (from the file exchange, by O. Woodford); I have extremely good experiences with this code. http://www.mathworks.nl/matlabcentral/fileexchange/23629-exportfig
It exports figures in the current figure window at higher resolutions.
After adding this file in your matlabpath, you should replace the latest two lines from your code into:
eval([['export_fig ' C{1}, '_', inputname(2), '_vs_', inputname(1),'.png']]
  댓글 수: 1
Diego
Diego 2012년 12월 4일
Thank you Wouter! I'll try it.
Regards,
Diego

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by