Difference between revisions of "Color tables"

From GRASS-Wiki
Jump to: navigation, search
(how to use grass color rules in qgis if they aren't already there)
(Using GRASS color palettes in QGIS)
Line 171: Line 171:
 
  rm palette_sst.grd
 
  rm palette_sst.grd
 
  cptsvg --geometry=300x45 -o palette_sst.svg -v palette_sst.cpt
 
  cptsvg --geometry=300x45 -o palette_sst.svg -v palette_sst.cpt
+
 
 +
 
 +
You can then copy the resulting .svg file into <tt>/usr/share/qgis/resources/cpt-city-qgis-min/grass/</tt> on Linux (or <tt>C:\Program&nbsp;Files\QGIS&nbsp;VERSION\apps\qgis\resources\cpt-city-qgis-min\grass\</tt> on MS Windows).
 +
 
  
 
[[Category: Documentation]]
 
[[Category: Documentation]]
 
[[Category: Colors]]
 
[[Category: Colors]]
 
[[Category: VTK]]
 
[[Category: VTK]]

Revision as of 19:39, 15 June 2016

About

Color tables live in $GISBASE/etc/colors (see SVN)

Modules

Addons

Repositories

  • There is an online colormap repository with many fine GMT (and many others) gradients at
http://soliton.vm.bytemark.co.uk/pub/cpt-city/
  • There are a number of command line tools for working with the GMT .cpt files at
http://soliton.vm.bytemark.co.uk/pub/jjg/en/code/cptutils/

Examples

Built in

The numeric values of following color tables can be found in the here

Colortable aspect.png


Colortable aspectcolr.png


Colortable bcyr.png


Colortable bgyr.png


Colortable byg.png


Colortable byr.png


Colortable celsius.png


Colortable corine clc.gcolors.png


Colortable curvature.png


Colortable differences.png


Colortable elevation.png


Colortable etopo2.png


Colortable evi.png


Colortable grey.png


Colortable grey1.0.png


Colortable grey255.png


Colortable gyr.png


Colortable haxby.png


Colortable ndvi.png


Colortable population.png


Colortable precipitation.png


Colortable rainbow.png


Colortable ramp.png


Colortable ryb.png


Colortable ryg.png


Colortable sepia.png


Colortable slope.png


Colortable srtm.png


Colortable terrain.png


Colortable wave.png

Addons

These user contributions can be found in the GRASS addons SVN repository

Colortable palette chl etc.gcolors.png


Colortable palette sst.gcolors.png


Colortable palette GMT ocean.gcolors.png


Colortable palette roygbiv.gcolors.png


Colortable palette high intensity.gcolors.png


Colortable palette low intensity.gcolors.png


  • The script used to create these thumbnails can be found on the discussion page.

Using GRASS color palettes in QGIS

Most of them can already be found there, you just have to hunt for them. In the raster layer properties window's style tab, select "Singleband pseudocolor" as the type, "Generate new color map", "New color ramp", for ramp type choose the "cpt-city", change to the sort by author tab, and look for "grass". They can also be found in the QGIS section cpt-city's QGIS theme.

If there's a new set of color rules which are not in QGIS, you can prepare a .svg palette file for use with QGIS using the following commands. Consider to then open a ticket in the QGIS issue tracker asking them to add it (and attach the file of course to save someone some work :)

You will need the cptsvg command line tool from cptutils and the GRASS 6 addon module r.out.gmt.

Examples:

g.region n=100 s=0 w=0 e=100 res=1
r.mapcalc "dummy = row()"

r.colors dummy color=roygbiv
r.out.gmt dummy out=roygbiv
rm roygbiv.grd
cptsvg --geometry=300x45 -o roygbiv.svg -v roygbiv.cpt

r.colors dummy rules=~/grass/svn/grass-addons/grass6/raster/r.colors.tools/palettes/palette_sst.gcolors
r.out.gmt dummy out=palette_sst
rm palette_sst.grd
cptsvg --geometry=300x45 -o palette_sst.svg -v palette_sst.cpt


You can then copy the resulting .svg file into /usr/share/qgis/resources/cpt-city-qgis-min/grass/ on Linux (or C:\Program Files\QGIS VERSION\apps\qgis\resources\cpt-city-qgis-min\grass\ on MS Windows).