Filter löschen
Filter löschen

plotting figures - pixel depth

1 Ansicht (letzte 30 Tage)
Diego
Diego am 4 Dez. 2012
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 Kommentar
Diego
Diego am 4 Dez. 2012
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...

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Wouter
Wouter am 4 Dez. 2012
Bearbeitet: Wouter am 4 Dez. 2012
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 Kommentar
Diego
Diego am 4 Dez. 2012
Thank you Wouter! I'll try it.
Regards,
Diego

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by