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

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

 Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Mayo de 2017

3 comentarios

Hi Walter,
My code has started working after I changed the memory preferences, however, it is taking way too long time to process. Is there any other option to extract the graphical output in eps that takes less time in less time? Thanks
Sorry, I do not know of faster methods -- at least not if you want vector output.
Thanks Walter! I have used the previous command plotyy, and that is way faster.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Display Image en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 14 de Mayo de 2017

Comentada:

el 17 de Mayo de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by