| tshow or hide figures with the show_figures flag - cosmo - front and backend fo… | |
| git clone git://src.adamsgaard.dk/cosmo | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit bb3d54aa230ee29a44e58f72a841b4638e3d09b8 | |
| parent 2ca0c20467bfb639003cda0641fc73e35997d678 | |
| Author: Anders Damsgaard <[email protected]> | |
| Date: Thu, 27 Aug 2015 16:06:18 +0200 | |
| show or hide figures with the show_figures flag | |
| Diffstat: | |
| M matlab/file_scanner_mcmc_starter.m | 6 +++++- | |
| M matlab/generate_plots.m | 43 +++++++++++++++++++----------… | |
| 2 files changed, 31 insertions(+), 18 deletions(-) | |
| --- | |
| diff --git a/matlab/file_scanner_mcmc_starter.m b/matlab/file_scanner_mcmc_star… | |
| t@@ -30,6 +30,10 @@ debug = true; % show debugging output to matlab console | |
| % output graphics formats | |
| graphics_formats = {'fig', 'png', 'pdf'}; | |
| +% show figures after they are generated in addition to saving them, | |
| +% values: 'on' or 'off' | |
| +show_figures = 'off'; | |
| + | |
| % number of MCMC walkers | |
| n_walkers = 1; | |
| t@@ -84,7 +88,7 @@ while 1 | |
| % generate plots | |
| %CompareWalks2(Ss, save_file) | |
| - generate_plots(Ss, save_file, graphics_formats) | |
| + generate_plots(Ss, save_file, graphics_formats, show_figures); | |
| % delete or archive the file so it is not processed again | |
| %delete(infile) | |
| diff --git a/matlab/generate_plots.m b/matlab/generate_plots.m | |
| t@@ -1,4 +1,4 @@ | |
| -function generate_plots(Ss, save_file, formats) | |
| +function generate_plots(Ss, save_file, formats, show_figures) | |
| %% Copied from m_pakke2014maj11/CompareWalks2.m | |
| % Generates and saves all relevant figures | |
| t@@ -9,7 +9,9 @@ Nwalkers = fixed_stuff.Nwalkers; | |
| M = size(fixed_stuff.mminmax,1); | |
| %Compare BurnIn | |
| -fh(1)=figure; | |
| + | |
| +fh(1) = figure('visible', show_figures); | |
| + | |
| for iwalk=1:min(4,Nwalkers) %only up to the first four walks | |
| QsBurnIns(:,iwalk)=Ss{iwalk}.QsBurnIn; | |
| Qss(:,iwalk) =Ss{iwalk}.Qs; | |
| t@@ -94,7 +96,7 @@ axis ij | |
| box on | |
| %Compare sampling cross-plots | |
| -fh = [fh;figure]; | |
| +fh = [fh;figure('visible', show_figures)]; | |
| Nbin = 50; | |
| mminmax = fixed_stuff.mminmax; %bounds of uniform prior intervals | |
| t@@ -137,7 +139,7 @@ for i1=1:M | |
| isub2 = iwalk; isub = isub2 + (isub1-1)*4; | |
| if isub>4*5 | |
| isub1 = 1; isub=1; | |
| - fh = [fh;figure]; | |
| + fh = [fh;figure('visible', show_figures)]; | |
| end | |
| subplot(5,4,isub) | |
| pcolor(xbins{i1},ybins,smoothgrid); | |
| t@@ -157,7 +159,7 @@ for i1=1:M | |
| end | |
| end | |
| -fh = [fh;figure]; | |
| +fh = [fh;figure('visible', show_figures)]; | |
| for i1 = 1:M | |
| for iwalk=1:min(4,Nwalkers) | |
| isub = (i1-1)*4 + iwalk; | |
| t@@ -174,26 +176,33 @@ for i1 = 1:M | |
| end | |
| end | |
| + | |
| + | |
| %Putting in titles over figure 2:4 | |
| -figure(fh(2)) | |
| + | |
| +figure(fh(2)); set(fh(2), 'Visible', show_figures) | |
| subplot(5,4,2) | |
| title(['Density cross-plots A. Result file =',save_file],'interp','none') | |
| -figure(fh(3)) | |
| + | |
| +figure(fh(3)); set(fh(3), 'Visible', show_figures) | |
| subplot(5,4,2) | |
| title(['Density cross-plots B. Result file =',save_file],'interp','none') | |
| -figure(fh(4)) | |
| + | |
| +figure(fh(4)); set(fh(4), 'Visible', show_figures) | |
| subplot(5,4,2) | |
| title(['Histograms. Result file =',save_file],'interp','none') | |
| -figpos1 = [6 474 1910 504]; | |
| -figpos2 =[ 12 94 645 887]; | |
| -figpos3 =[ 610 94 645 887]; | |
| -figpos4 =[ 1207 94 740 887]; | |
| -set(fh(2),'pos',figpos2) | |
| -set(fh(3),'pos',figpos3) | |
| -set(fh(4),'pos',figpos4) | |
| -set(fh(1),'pos',figpos1) | |
| -figure(fh(1)) | |
| +if strcmp(show_figures, 'on') | |
| + figpos1 = [6 474 1910 504]; | |
| + figpos2 =[ 12 94 645 887]; | |
| + figpos3 =[ 610 94 645 887]; | |
| + figpos4 =[ 1207 94 740 887]; | |
| + set(fh(2),'pos',figpos2) | |
| + set(fh(3),'pos',figpos3) | |
| + set(fh(4),'pos',figpos4) | |
| + set(fh(1),'pos',figpos1) | |
| + figure(fh(1)) | |
| +end | |
| for i=1:4 | |
| figure_save_multiformat(figure(fh(i)), ... |