altmany / altmany/export_fig

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

Offen
#152 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
MATLAB
Sterne
1.4k
Forks
366
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.