; docformat = 'rst' ;+ ; Load a color table by index. This routine is directly analogous to LOADCT, ; but with more color table options. ; ; The default color tables: ; ; .. image:: default-colors.png ; ; The Brewer color tables are split into three types: sequential, diverging, ; and qualitative. Sequential color tables are simple sequences from white to ; a given color. The diverging color tables have white in the middle of the ; color table and progress in each direction towards two different colors. The ; qualitative color tables contain only a few colors for labeling purposes. ; The qualitative color tables are expanded to take up the same space of the ; other color tables in the graphic below: ; ; .. image:: brewer-colors.png ; ; The Yorick/Gist color tables: ; ; .. image:: gist-colors.png ; ; The matplotlib color tables: ; ; .. image:: mpl-colors.png ; ; :Categories: ; direct graphics ; ; :Copyright: ; Color tables accessed with VIS_LOADCT and VIS_XLOADCT are provided ; courtesy of Brewer, Cynthia A., 2007. http://www.ColorBrewer.org, ; accessed 20 October 2007. ; ; Apache-Style Software License for ColorBrewer software and ColorBrewer ; Color Schemes ; ; Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania ; State University. ; ; Licensed under the Apache License, Version 2.0 (the "License"); you may ; not use this file except in compliance with the License. You may obtain ; a copy of the License at:: ; ; http://www.apache.org/licenses/LICENSE-2.0 ; ; Unless required by applicable law or agreed to in writing, software ; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ; License for the specific language governing permissions and limitations ; under the License. ; ; :Params: ; table : in, optional, type=long ; table number, 0-40 if using default color table file, 0-34 for Brewer ; color tables, 0-6 for the Yorick/Gist color tables, or 0-15 for the ; matplotlib color tables ; ; :Keywords: ; file : in, optional, type=string, default=colors.tbl ; filename of color table file; this is present to make VIS_LOADCT ; completely implement LOADCT's interface, it would normally not be used ; brewer : in, optional, type=boolean ; set to use the brewer color tables ; mpl : in, optional, type=boolean ; set to use the matplotlib color tables ; gist : in, optional, type=boolean ; set to use the Gist/Yorick color tables ; _ref_extra : in, out, optional, type=keyword ; keywords to LOADCT ;- pro vis_loadct, table, file=file, brewer=brewer, mpl=mpl, gist=gist, $ _ref_extra=e compile_opt strictarr case 1 of keyword_set(brewer): ctfilename = filepath('brewer.tbl', root=vis_src_root()) keyword_set(mpl): ctfilename = filepath('mpl.tbl', root=vis_src_root()) keyword_set(gist): ctfilename = filepath('gist.tbl', root=vis_src_root()) n_elements(file) gt 0L: ctfilename = file else: endcase loadct, table, file=ctfilename, _strict_extra=e end ; Main-level program to produce image of color tables nColorTables = 35 colorTableHeight = 13 colorTableWidth = 256 gap = 5 window, xsize=256, ysize=nColorTables * colorTableHeight im = bindgen(256) # (bytarr(colorTableHeight) + 1B) device, decomposed=0 vis_loadct, get_names=names, /brewer for ct = 0L, nColorTables - 1L do begin vis_loadct, ct, /brewer if (ct gt 26) then begin ncolors = ([12, 9, 9, 8, 8, 8, 12, 8])[ct - 27] tvlct, r, g, b, /get r = congrid(r[0:ncolors - 1], 256, /center) g = congrid(g[0:ncolors - 1], 256, /center) b = congrid(b[0:ncolors - 1], 256, /center) tvlct, r, g, b endif tv, im, 0, (nColorTables - ct - 1) * colorTableHeight endfor end