altmany / altmany/export_fig

running export_fig via windows 7 task scheduler when user is not logged in

Abierto
#152 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
MATLAB
Estrellas
1.4k
Forks
366
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

hi there,

export_fig seems to work fine when running matlab when you are logged into the machine.
When running matlab via task scheduler and with the job set to run irrespective of whether the user is logged in or not, the plots become compressed and illegible.

When setting figure handle properties such as 'PaperPosition', it would be great if export_fig could interpret these, if it doesn't already.

I can't seem to attach files, so here is the function script:

```Matlab
function plotTest()
% plotTest();

%% initial setup
t = (1:30)';

%% create plot
close all
hfig = figure('Name','plot test','NumberTitle','off','units','normalized','outerposition',[0 0 1 1]);

for i=1:6
ax(i) = subplot(3,3,i);
X = cumsum(randn(30,5));

h = plot(t,X(:,1),':o',t,X(:,2),':d',t,X(:,3),':s',t,X(:,4),':^',t,X(:,5),':x');

set(h(1), 'MarkerFaceColor', get(h(1), 'Color'));
set(h(2), 'MarkerFaceColor', get(h(2), 'Color'));
set(h(3), 'MarkerFaceColor', get(h(3), 'Color'));
set(h(4), 'MarkerFaceColor', get(h(4), 'Color'));
set(h(5), 'MarkerFaceColor', get(h(5), 'Color'));

grid on
legend('x1','x2','x3','x4','x5')
end

hfig = tightfig(hfig);
pause(1)

%% collect debugging information
diary('C:\temp\myLogFile.txt')
fprintf('\n gcf: \n')
get(gcf)
res = get(groot,'ScreenPixelsPerInch');
fprintf(['\nresolution = ' num2str(res) '\n'])
currentScreenSizeFromOS = get(groot, 'ScreenSize');
fprintf(['current screen size from OS = ' num2str(currentScreenSizeFromOS) '\n\n'])
diary off

%% maximizePlot
hFig = gcf;
jFig = get(handle(hFig), 'JavaFrame');
jFig.setMaximized(true);

%% normal printing and exporting
print(hfig, 'C:\temp\plotTest_print.png', '-dpng', '-r300');

%% printing by specifying paper position
preferredScreenSize = [0 0 2560 1440]; % in pixels
hfig.PaperUnits = 'inches';
hfig.PaperPosition = preferredScreenSize./res; % convert to inches
print(hfig, '-dpng', '-r96', 'C:\temp\plotTest_printPaperPos.png')
supertitle('page 1 buddy','FontSize',16)
export_fig('-pdf', '-q100','handle',hfig,'C:\temp\plotTest_printPaperPos.pdf')
supertitle('page 2 buddy','FontSize',16)
export_fig('-pdf', '-q100','-append','handle',hfig,'C:\temp\plotTest_printPaperPos.pdf')

close

end
```

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.