Home > atmlab > geoplots > gmt > psbox.m

psbox

PURPOSE ^

PSBOX Makes boxes in gmtplot

SYNOPSIS ^

function commands = psbox(file,in,commands)

DESCRIPTION ^

 PSBOX Makes boxes in gmtplot

 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 Salomon Eliasson
 $Id: psbox.m 8362 2013-04-20 18:30:35Z seliasson $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

psbox.m

SOURCE CODE ^

0001 function commands = psbox(file,in,commands)
0002 % PSBOX Makes boxes in gmtplot
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 Salomon Eliasson
0011 % $Id: psbox.m 8362 2013-04-20 18:30:35Z seliasson $
0012 
0013 colors = in.plot.psbox.colors;
0014 thick = in.plot.psbox.thick;
0015 pb = in.plot.psbox.psbox;
0016 region = in.plot.region;
0017 proj = in.plot.proj;
0018 
0019 a=cell(5,1);
0020 for i = 1:size(pb,1)
0021     b = pb(i,1:2);
0022     t = pb(i,3:4);
0023     
0024     %stdin
0025     %% get full coordinates
0026     a{1}=sprintf('%g %g',b(1),b(2));
0027     a{2}=sprintf('%g %g',b(1),t(2));
0028     a{3}=sprintf('%g %g',(t(1)+b(1))/2,t(2));
0029     a{4}=sprintf('%g %g',t(1),t(2));
0030     a{5}=sprintf('%g %g',t(1),b(2));
0031     a{6}=sprintf('%g %g',(t(1)+b(1))/2,b(2));
0032     a{7}=a{1};
0033 
0034     stdin=[a{1},' M\n',a{2},' D\n',a{3},' D\n',a{4},' D\n',a{5},' D\n',a{6},' D\n',a{7},' D'];
0035     box = sprintf('echo -e "%s" |',stdin);
0036     box = sprintf('%s psxy -R%s -J%s -A',box,region,proj);
0037     box = sprintf('%s %s',box,in.plotPlacement);
0038     
0039     % color and size of box
0040     
0041     c = colors{i};
0042     s = thick{i};
0043     box = sprintf('%s -W%g/%g/%g/%g',box,s,c(1),c(2),c(3));
0044     
0045     % selects Overlay plot mode and assume more pscode will be appended later
0046     box = sprintf('%s -K -O >> %s.ps',box,file);
0047     commands{end+1} = box;
0048 end

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