Ps.map multi pane example

From GRASS-Wiki
(Redirected from Psmap multi pane example)
Jump to navigation Jump to search


If you want to show a number of raster maps side by side in a paneled figure you will have to do it in a two step process. The first step is to create each panel as an EPS file, the second step is to include these EPS files in the ps.map command file. In this example the GRASS 6.3 d.out.file module is used to create the intermediary Encapsulated PostScript files using the GRASS PostScript driver. You can just as well use ps.map with the -e flag to create the EPS files.


fourmaps.ps


This example uses the Spearfish, South Dakota sample dataset.

Create a shaded relief map

 g.region rast=elevation.dem
 r.shaded.relief map=elevation.dem shad=elev.shad_relf

Create the EPS components

 export GRASS_WIDTH=640
 export GRASS_HEIGHT=480
 d.mon x0
 
 d.erase
 d.his h=elevation.dem i=elev.shad_relf brighten=50
 echo "A" | d.text -b color=black size=10 at=93,5
 d.out.file output=elevation format=eps size=950,720
 
 d.erase
 d.his h=slope i=elev.shad_relf brighten=40
 echo "B" | d.text -b color=black size=10 at=93,5
 d.out.file output=slope format=eps size=950,720
 
 d.erase
 d.his h=landcover.30m i=elev.shad_relf brighten=55
 echo "C" | d.text -b color=black size=10 at=93,5
 d.out.file output=landcover format=eps size=950,720
 
 d.erase
 d.his h=trn.sites i=elev.shad_relf brighten=15
 echo "D" | d.text -b color=black size=10 at=93,5
 d.out.file output=training format=eps size=950,720

Create the ps.map map

 ps.map -r out=fourmaps.ps << EOF
 paper a4
   end
 maploc 1.6 1
 border 
   color white
   end
 eps 25% 75%
   epsfile elevation.eps
   scale 0.25
   end
 text 25% 53% Elevation
   fontsize 16
   end
 eps 75% 75%
   epsfile slope.eps
   scale 0.25
   end
 text 75% 53% Slope
   fontsize 16
   end
 eps 25% 25%
   epsfile landcover.eps
   scale 0.25
   end
 text 25% 3% Landcover
   fontsize 16
   end
 eps 75% 25%
   epsfile training.eps
   scale 0.25
   end
 text 75% 3% Training Areas
   fontsize 16
   end
 end
 EOF

Convert PostScript to PDF (ps2pdf comes with the gs-common Debian package)

ps2pdf13 fourmaps.ps