Home > atmlab > geoplots > gmt > pstext.m

pstext

PURPOSE ^

PSTEXT Make text to overlay GMT plot

SYNOPSIS ^

function command = pstext(file,in,placement)

DESCRIPTION ^

 PSTEXT Make text to overlay GMT plot
 (x, y, size, angle, fontno, justify, text) see help gmt_plot
 IN      file     %s       file to append to
         in       struct   options here (see help gmt_plot)
         placement %s      string command about where to pu the map
         (common to all commands)

 OUT     command str     string command for systemcall of pstext

 Created by Salomon Eliasson
 $Id: pstext.m 7954 2012-10-28 20:57:41Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

pstext.m

SOURCE CODE ^

0001 function command = pstext(file,in,placement)
0002 % PSTEXT Make text to overlay GMT plot
0003 % (x, y, size, angle, fontno, justify, text) see help gmt_plot
0004 % IN      file     %s       file to append to
0005 %         in       struct   options here (see help gmt_plot)
0006 %         placement %s      string command about where to pu the map
0007 %         (common to all commands)
0008 %
0009 % OUT     command str     string command for systemcall of pstext
0010 %
0011 % Created by Salomon Eliasson
0012 % $Id: pstext.m 7954 2012-10-28 20:57:41Z seliasson $
0013 
0014 lat     = {in.lat};
0015 lon     = {in.lon};
0016 thick   = {in.thick};
0017 angle   = {in.angle};
0018 fontnum = {in.fontnum};
0019 justify = {in.justify};
0020 txt     = {in.text};
0021 
0022 % Create an intermediate file that contains the required input per
0023 % row/entry
0024 txtfile = 'pstextfile.d';
0025 fid=fopen(txtfile,'w'); cleanup = onCleanup(@() fclose(fid));
0026 for i = 1:numel(txt)
0027     annotstr = sprintf('%s %s %s %s %s %s %s\n',...
0028         getAnnotFormat(lon{i}),getAnnotFormat(lat{i}),'%.0f',...
0029         getAnnotFormat(angle{i}),'%.0f','%.0f','%s');
0030     fprintf(fid,annotstr,lon{i},lat{i},thick{i},angle{i},...
0031         fontnum{i},justify{i},txt{i});
0032 end
0033 
0034 %load file and color (currently only one color)
0035 command = sprintf('pstext %s -R -J -G%s',txtfile,in(1).color);
0036 command = sprintf('%s -K -O %s >> %s.ps',command,placement,file);

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