NCL Home > Documentation > Graphics > Graphical Interfaces


Reverses the color map for the given workstation.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"  ; This library is automatically loaded
                                                          ; from NCL V6.2.0 onward.
                                                          ; No need for user to explicitly load.

	procedure gsn_reverse_colormap (
		wks [1] : graphic   



A Workstation identifier. The identifier is one returned either from calling gsn_open_wks or calling create to create a Workstation object.


This procedure reverses the color map for the given workstation, keeping the foreground and background colors the same.

Note: reversing color maps using this function is considered the older (pre NCL V6.1.0) way of dealing with color maps in NCL. It is better to use read_colormap_file to read a predefined color map and then the "::-1" syntax to reverse it. See the examples below.

See Also

read_colormap_file, draw_color_palette, gsn_define_colormap, gsn_retrieve_colormap, gsn_merge_colormaps, gsn_draw_colormap, gsn_draw_named_colors


Example 1 (newer way)

Draw the BlueRed color map, and then reverse it and draw it again.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

  wks = gsn_open_wks("x11","color")


  cmap = read_colormap_file("BlueRed")   ; read the color map
  draw_color_palette(wks,cmap(::-1,:),False)      ; draw the reversed color map

Example 1 (older way)

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

  wks = gsn_open_wks("x11","color")

  gsn_draw_colormap(wks)              ; Draw the color map.
  gsn_reverse_colormap(wks)           ; Reverse the color map.
  gsn_draw_colormap(wks)              ; Draw the new color map.

See also the suite of color and color map examples.