Home > atmlab > geoplots > gmt > pslocations.m

pslocations

PURPOSE ^

PSLOCATIONS Adds location markers to a GMT plot.

SYNOPSIS ^

function command = pslocations(file,in,command)

DESCRIPTION ^

 PSLOCATIONS Adds location markers to a GMT plot.

 IN      file     %s       file to append to
         in       struct   options here (see help gmt_plot)
         command  cell     cell of string commands for systemcall

 OUT     command  cell     cell of string commands for systemcall

 Created by Oliver Lemke & Salomon Eliasson
 $Id: pslocations.m 8362 2013-04-20 18:30:35Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

pslocations.m

SOURCE CODE ^

0001 function command = pslocations(file,in,command)
0002 % PSLOCATIONS Adds location markers to a GMT plot.
0003 %
0004 % IN      file     %s       file to append to
0005 %         in       struct   options here (see help gmt_plot)
0006 %         command  cell     cell of string commands for systemcall
0007 %
0008 % OUT     command  cell     cell of string commands for systemcall
0009 %
0010 % Created by Oliver Lemke & Salomon Eliasson
0011 % $Id: pslocations.m 8362 2013-04-20 18:30:35Z seliasson $
0012 
0013 for loc = in.locations
0014     psloc = sprintf('echo "%g %g" | psxy ', loc.lon, loc.lat);
0015     psloc = sprintf('%s -R -J',psloc);
0016     psloc = sprintf('%s %s',psloc,in.plotPlacement);
0017     
0018     
0019     
0020     if isfield(loc,'shape')
0021         shape = loc.shape;
0022     else
0023         shape = 'c'; % default shape (circle)
0024     end
0025     
0026     if isfield(loc,'size')
0027         sze = loc.size;
0028         if isnumeric(sze)
0029             sze = [num2str(sze),'c']; %assume cm
0030         end
0031     else
0032         sze   = '.08i'; %default size
0033     end
0034     
0035     psloc = sprintf('%s -S%s%s',psloc,shape,sze);
0036     
0037     color = 'white'; % default color
0038     if isfield(loc,'color') && ~isempty(loc.color)
0039         color = loc.color;
0040     end
0041     psloc = sprintf('%s -G%s -Wthinner',psloc,color);
0042     
0043     % selects Overlay plot mode and assume more pscode will be appended later
0044     psloc = sprintf('%s -O -K',psloc);
0045     if ~isempty(shape)
0046         command{end+1} = sprintf('%s >> %s.ps',psloc,file);
0047     end
0048     if isfield(loc,'name') && ~isempty(loc.name)
0049         tsize=15;
0050         if isfield(loc,'textsize') && ~isempty(loc.textsize)
0051             tsize = loc.textsize;
0052         end
0053         talign='LT';
0054         if isfield(loc,'textalign') && ~isempty(loc.textalign)
0055             talign = loc.textalign;
0056         end
0057         pstxt = sprintf('echo "%g %g %g 0 1 %s %s" | pstext ', ...
0058             loc.lon, loc.lat, tsize, talign, loc.name);
0059         
0060         % Offset text from data point
0061         pstxt = sprintf('%s -Dj0.05i/0.05i',pstxt);
0062         
0063         pstxt = sprintf('%s -R -J',pstxt);
0064         
0065         pstxt = sprintf('%s %s',pstxt,in.plotPlacement);
0066         
0067         if isfield(loc,'textcolor') && ~isempty(loc.textcolor)
0068             color = loc.textcolor;
0069         end
0070         pstxt = sprintf('%s -G%s',pstxt,color);
0071         
0072         % selects Overlay plot mode and assume more pscode will be appended later
0073         pstxt = sprintf('%s -O -K',pstxt);
0074         
0075         command{end+1} = sprintf('%s >> %s.ps',pstxt,file);
0076     end
0077 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005