# VMT_SaveFigs

## PURPOSE

Saves the figures (specified by fignums) from VMT as .PNG or EPS files

## SYNOPSIS

function VMT_SaveFigs(pathname,to_export,figure_style)

## DESCRIPTION

     Saves the figures (specified by fignums) from VMT as .PNG or EPS files
     (300 dpi).

     Added EPS 8-7-12

     FLE Changes 1/3/2013:
       1. Edited code for formating and efficiency.
       2. Changed the default printparameters to produce white backgrounds,
          and recolor the bed in Fig #3 to be black.
       3. Added functionality to apply custom cpt colormaps to the contour and
          plan view plots (currently disabled)

     P.R. Jackson, USGS, 2-10-09
     Last modified: F.L. Engel, USGS, 2/20/2013

## CROSS-REFERENCE INFORMATION

This function calls:

- VMT_ExportFIG Exports the given figure and formats it according to the

This function is called by:

- VMT --- THE VELOCITY MAPPING TOOLBOX ---

## SOURCE CODE

    0001 function VMT_SaveFigs(pathname,to_export,figure_style)
    0002 % Saves the figures (specified by fignums) from VMT as .PNG or EPS files
    0003 % (300 dpi).
    0004 %
    0005 % Added EPS 8-7-12
    0006 %
    0007 % FLE Changes 1/3/2013:
    0008 %   1. Edited code for formating and efficiency.
    0009 %   2. Changed the default printparameters to produce white backgrounds,
    0010 %      and recolor the bed in Fig #3 to be black.
    0011 %   3. Added functionality to apply custom cpt colormaps to the contour and
    0012 %      plan view plots (currently disabled)
    0013 %
    0014 % P.R. Jackson, USGS, 2-10-09
    0015 % Last modified: F.L. Engel, USGS, 2/20/2013
    0016
    0017
    0018
    0019
    0020
    0021 % disp('{Saving Figures...') %FIXME: migrate command line messages
    0022 if strcmpi('presentation',figure_style)
    0023     style_print = false;
    0024
    0025 else
    0026     style_print = true;
    0027
    0028 end
    0029
    0030 % Export Figure Defaults
    0031 BkgdColor   = 'white';
    0032 AxColor     = 'black';
    0033 FigColor    = 'white'; % [0.3 0.3 0.3]
    0034 FntSize     = 14;
    0035 Res         = 300; % dpi
    0036 Format      = 'png';
    0037
    0038 % Query the user for the format
    0039 Format = questdlg('What figure format would you prefer?', ...
    0040     'Figure Export', ...
    0041     'png','eps','png');
    0042
    0043 % Export the figure(s)
    0044 for i = 1:length(to_export)
    0045     switch to_export{i}
    0046         case 'Plan View Map'
    0047             % Make figure current focus
    0048             figure(findobj('name',to_export{i}))
    0049             if style_print
    0050                 % Apply a custom colormap
    0051                 if 0
    0052                     cptcmap('printvelocity.cpt')
    0053                 end
    0054
    0055             else
    0056                 % Apply a custom colormap
    0057                 if 0
    0058                     cptcmap('printvelocity.cpt')
    0059                 end
    0060                 BkgdColor   = 'black';
    0061                 AxColor     = 'white';
    0062                 FigColor    = 'black'; % [0.3 0.3 0.3]
    0063             end
    0064
    0065             VMT_ExportFIG(...
    0066                 pathname,...
    0067                 to_export{i},...
    0068                 BkgdColor,...
    0069                 AxColor,...
    0070                 FigColor,...
    0071                 FntSize,...
    0072                 Res,...
    0073                 Format);
    0074
    0075         case 'Mean Cross Section Contour'
    0076             % Make figure current focus
    0077             figure(findobj('name',to_export{i}))
    0078             if style_print
    0079
    0080                 %set(findobj(gcf,'tag','Colorbar')           ,'location' ,'southoutside')
    0081                 set(findobj(gca,'tag','PlotBedElevation')   ,'color'    ,'k')
    0082                 set(findobj(gca,'tag','ReferenceVectorText'),'color'    ,'k')
    0083
    0084                 % Apply a custom colormap for printing
    0085                 if 0
    0086                     cptcmap('printvelocity.cpt')
    0087                     %cptcmap('diverging_BrBg.cpt','flip',true)
    0088                 end
    0089
    0090             else
    0091
    0092
    0093                 %set(findobj(gcf,'tag','Colorbar')           ,'location' ,'southoutside')
    0094                 set(findobj(gca,'tag','PlotBedElevation')   ,'color'    ,'w')
    0095                 set(findobj(gca,'tag','ReferenceVectorText'),'color'    ,'w')
    0096
    0097                 % Apply a custom colormap
    0098                 if 0
    0099                     cptcmap('printvelocity.cpt')
    0100                     %cptcmap('diverging_BrBg.cpt')
    0101                 else
    0102                     colormap jet
    0103                 end
    0104
    0105                 BkgdColor = 'black';
    0106                 AxColor   = 'white';
    0107                 FigColor  = [0.3 0.3 0.3];
    0108
    0109             end
    0110
    0111             VMT_ExportFIG(...
    0112                 pathname,...
    0113                 to_export{i},...
    0114                 BkgdColor,...
    0115                 AxColor,...
    0116                 FigColor,...
    0117                 FntSize,...
    0118                 Res,...
    0119                 Format);
    0120     end
    0121 end
    0122