Ps.map multi pane example: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
No edit summary  | 
				 (pretty code)  | 
				||
| Line 11: | Line 11: | ||
Create a shaded relief map  | Create a shaded relief map  | ||
<source lang="bash">  | |||
  g.region rast=elevation.dem  |   g.region rast=elevation.dem  | ||
  r.shaded.relief map=elevation.dem shad=elev.shad_relf  |   r.shaded.relief map=elevation.dem shad=elev.shad_relf  | ||
</source>  | |||
Create the EPS components  | Create the EPS components  | ||
<source lang="bash">  | |||
  export GRASS_WIDTH=640  |   export GRASS_WIDTH=640  | ||
  export GRASS_HEIGHT=480  |   export GRASS_HEIGHT=480  | ||
| Line 38: | Line 41: | ||
  echo "D" | d.text -b color=black size=10 at=93,5  |   echo "D" | d.text -b color=black size=10 at=93,5  | ||
  d.out.file output=training format=eps size=950,720  |   d.out.file output=training format=eps size=950,720  | ||
</source>  | |||
Create the ps.map map  | Create the ps.map map  | ||
<source lang="bash">  | |||
  ps.map -r out=fourmaps.ps << EOF  |   ps.map -r out=fourmaps.ps << EOF  | ||
  paper a4  |   paper a4  | ||
| Line 78: | Line 82: | ||
  end  |   end  | ||
  EOF  |   EOF  | ||
</source>  | |||
Convert PostScript to PDF (ps2pdf comes with the gs-common Debian package)  | Convert PostScript to PDF (ps2pdf comes with the gs-common Debian package)  | ||
  ps2pdf13 fourmaps.ps  |   ps2pdf13 fourmaps.ps  | ||
Revision as of 11:21, 28 December 2009
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.

This example uses the Speafish, 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