Azzera filtri
Azzera filtri

plotting figures - pixel depth

1 visualizzazione (ultimi 30 giorni)
Diego
Diego il 4 Dic 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 Commento
Diego
Diego il 4 Dic 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...

Accedi per commentare.

Risposta accettata

Wouter
Wouter il 4 Dic 2012
Modificato: Wouter il 4 Dic 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 Commento
Diego
Diego il 4 Dic 2012
Thank you Wouter! I'll try it.
Regards,
Diego

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by