フィルターのクリア

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 Center および File ExchangePrinting and Saving についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by