How can I get .EPS output using yyaxis and for function?

7 vues (au cours des 30 derniers jours)
Muhammad yahya
Muhammad yahya le 14 Mai 2017
Commenté : Muhammad yahya le 17 Mai 2017
Hi, I am encountering an issue regarding taking extracting out the figure after using yyaxis. Although, I am able to extract the figure in .pdf format, this puts the whole page when putting in latex. I can use trim function in latex, but that would not be economical. I tried different ways of extracting output in the form of eps, but none works.
cd 'D:\Matlab\Article\Graphs'
for i=1:20
yyaxis right
plot(dates,prices(:,i));
ylabel('Price','interpreter','latex', 'FontSize',10, 'FontName','Times')
yyaxis left
plot(dates,returns(:,i));
ylabel('Return', 'interpreter','latex', 'FontSize',10, 'FontName','Times')
set(gca, 'FontName', 'Times')
print(sprintf('tsline_%d.pdf', i), '-dpdf', '-bestfit');
end
I used the above given function to extract .pdf.
I am using on one y-axis the price series and the return series on the other and the x-axis constitutes of dates. I have twenty columns for each series and number of observations are 7825. To extract in eps, I used the following function:
cd 'D:\Matlab\Article\Graphs'
for i=1:20
yyaxis right
plot(dates,prices(:,i));
ylabel('Price','FontSize',8)
yyaxis left
plot(dates,returns(:,i));
ylabel('Return', 'FontSize',8)
saveas(gcf,strcat('figure',num2str(i),'.eps'));
i = i+1;
end
However, this gives me just the firs graph output and then stops and returns error of insufficient java memory and error in saveas (line 168). print(h, name, ['-d' dev{i}] ). I changed the saveas to print as well, but the problem persists.
I would really appreciate any sort of help.
Many Thanks. :)
Yahya

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Mai 2017
  3 commentaires
Walter Roberson
Walter Roberson le 15 Mai 2017
Sorry, I do not know of faster methods -- at least not if you want vector output.
Muhammad yahya
Muhammad yahya le 17 Mai 2017
Thanks Walter! I have used the previous command plotyy, and that is way faster.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Display Image dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by