필터 지우기
필터 지우기

Save pictures in .pdf, .fig, and .jpeg with different paper orientation

조회 수: 4 (최근 30일)
Tiago Dias
Tiago Dias 2018년 1월 8일
댓글: Tiago Dias 2018년 1월 11일
Hello,
I have a question about saving the same pictures in different formats (.pdf, .jpeg, .fig) with diferent orientation.
%if true
A = readtable('RON.xlsx');
tempo_A = A{:,1:2:end};
[n,m] = size(A);
variavel_original = A{:,2:2:end};
var = {'Y1','Y2','Y3','Y4'};
guardar = {'Y1','Y2','Y3','Y4'};
guardar2 = {'YY'};
var_original = {'Y1','Y2','Y3','Y4'};
n_var = length(var);
for j=1:n_var
original=figure;
set(original,'PaperUnits','centimeters','PaperPosition',[0 0 29 21],'PaperOrientation','landscape');
plot(tempo_A(:,j),variavel_original(:,j),'-b*');
for i=1:n
text(tempo_A(i,j),variavel_original(i,j),num2str(i),'Color','b','FontSize',8,'VerticalAlignment','top');
end
title(var(j));
grid on
xlabel('tempo');
ylabel('Y');
legend(var_original(j),'Location','best','Orientation','vertical');
saveas(original,fullfile('C:\Users\TiagoAlexandre\Documents\MATLAB\GALP\RON\Originais', guardar{j}), 'fig');
saveas(original,fullfile('C:\Users\TiagoAlexandre\Documents\MATLAB\GALP\RON\Originais', guardar{j}), 'jpeg');
saveas(original,fullfile('C:\Users\TiagoAlexandre\Documents\MATLAB\GALP\RON\Originais', guardar{j}), 'pdf');
end
% code
%end
So, in the set command I choose the option landscape, it creates a pdf file landscape of size almost A4 it's ok for the purpose.
Question 1 -> I wanted to save the jpeg file as 'portrait', how would I do that? (i want the jpeg file the same way as the pdf file, (the plot left to right). Question 2 -> I would want to save the .fig file a bit bigger, like a maximize window.
Thanks for your time, Tiago
  댓글 수: 3
Manan Mishra
Manan Mishra 2018년 1월 11일
Glad that you figured it on your own.
It would be beneficial for the community in future if you can share your solution in the answers section.
Tiago Dias
Tiago Dias 2018년 1월 11일
Since i place the set as landscape, the pdf will be landscape, to make the jpeg landscape I did the following
saveas(original,fullfile('C:\Users\TiagoAlexandre\Documents\MATLAB\GALP\RON\Originais', guardar{j}), 'pdf');
orient portrait
saveas(original,fullfile('C:\Users\TiagoAlexandre\Documents\MATLAB\GALP\RON\Originais', guardar{j}), 'jpg');
So this way, the pdf is landscape, and the jpg since I wrote the command orient portrait, it will rotate the jpg file to the way like the pdf file is saved.

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

답변 (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