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

3 views (last 30 days)
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 Comments
Manan Mishra
Manan Mishra on 11 Jan 2018
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 on 11 Jan 2018
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.

Sign in to comment.

Answers (0)

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!