欢迎光临散文网 会员登陆 & 注册

GMT中翻转色度条的颜色

2021-12-26 09:49 作者:我是水怪的哥  | 我要投稿

在使用GMT绘图时,比如同样是rainbow色度条,在水储量大小表示时,蓝色更能代表水量充足,而黄色是亏损;而如果是表示温度,暖色可以代表高温,冷色低温。因此在科研绘图中,我们需要翻转色度条。

下面我举一例:

比如是如下的情况,采用等效水高表示:如果需要翻转色度条,需要更改makecpt语句

makecpt -Cjet -T-0.6/0.6/0.05  >1.cpt【之前】

makecpt -Cjet -T-0.6/0.6/0.05  -I>1.cpt【翻转】

我们可以看到只需要在命令中加上 -I即可。

翻转前
翻转后

makecpt命令的使用说明:

 makecpt [-A[+]<transparency>] [-C<cpt>|colors] [-D[i|o]] [-E<nlevels>] [-F[R|r|h|c][+c]] [-G<zlo>/<zhi>]

        [-I[c][z]] [-L] [-M] [-N] [-Q[i|o]] [-T<z_min>/<z_max>[/<z_inc>[+n]] | -T<table> | -T<z1,z2,...zn>] [-V[<level>]] [-W[w]]

        [-Z] [-bi[<ncol>][t][w][+L|B]] [-di<nodata>] [-i<cols>[+l][+s<scale>][+o<offset>][,...]]

        [-ho[<nrecs>][+c][+d][+r<remark>][+t<title>]]

        OPTIONS:

        -A Set constant transparency for all colors; prepend + to also include back-, for-, and nan-colors [0]

        -C Specify a colortable [Default is rainbow]:

           [Notes: R=Default z-range, H=Hinge, C=colormodel]

           ---------------------------------------------------------------------------------------

           abyss       : Black/dark blue to lightblue for bathymetry [R=-8000/0, C=RGB]

           bathy       : Like abyss but via aquamarine at mid-depths [R=-8000/0, C=RGB]

           categorical : Color table particularly suitable for categorical data [vRGB]

           cool        : Linear change from blue to magenta [C=RGB]

           copper      : Dark to light copper brown [C=RGB]

           cubhelix    : Intensity colormap via cube helix by Dave Green [C=RGB]

           cyclic      : Cyclic colormap, spans 360 degrees of hue [C=HSV]

           dem1        : Digital Elevation Model (DEM) scale by Thomas Dewez [R=0/800, C=RGB]

           dem2        : Digital Elevation Model (DEM) scale by Dewez/Wessel [R=0/4900, C=RGB]

           dem3        : Digital Elevation Model (DEM) scale by Paul Wessel [R=0/6000, C=RGB]

           dem4        : Digital Elevation Model (DEM) scale for Wikipedia figures [R=0/1500, C=RGB]

           drywet      : Goes from dry to wet colors [C=RGB]

           earth       : Colors for global bathymetry/topography relief [R=-11000/9000, H=0, C=RGB]

           elevation   : Washed-out colors for topography [R=0/7000, C=RGB]

           etopo1      : Colormap used in the ETOPO1 global relief map [R=-11000/8500, H=0, C=RGB]

           gebco       : Colors for GEBCO bathymetric charts [R=-7000/0, C=RGB]

           geo         : Colors for global bathymetry/topography relief [R=-8000/8000, H=0, C=RGB]

           globe       : Colors for global bathymetry/topography relief [R=-10000/10000, H=0, C=RGB]

           gray        : Gray linear ramp from black to white [C=RGB]

           haxby       : Bill Haxby's color scheme for geoid & gravity [C=RGB]

           hot         : Black through red and yellow to white [C=RGB]

           ibcso       : The IBCSO bathymetry colors [R=-12000/0, C=RGB]

           inferno     : New colormap Option B from matplotlib [C=RGB]

           jet         : Dark to light blue, white, yellow and red [C=RGB]

           magma       : New colormap Option A from matplotlib [C=RGB]

           nighttime   : Colors for DMSP-OLS Nighttime Lights Time Series [C=HSV]

           no_green    : For those who hate green [H=0, C=RGB]

           ocean       : White-green-blue bathymetry scale [R=-8000/0, C=RGB]

           paired      : Qualitative color map with 6 pairs of colors [C=RGB]

           panoply     : Default colormap of Panoply [C=RGB]

           plasma      : New colormap Option C from matplotlib [C=RGB]

           polar       : Blue via white to red [H=0, C=RGB]

           rainbow     : Rainbow: magenta-blue-cyan-green-yellow-red [C=HSV]

           red2green   : Polar scale from red to green via white [H=0, C=RGB]

           relief      : Wessel/Martinez colors for topography [R=-8000/+8000, H=0, C=RGB]

           seafloor    : Purple-blue-white bathymetry scale [R=-6000/0, C=RGB]

           sealand     : Smith bathymetry/topography scale [R=-6000/+3000, H=0, C=HSV]

           seis        : R-O-Y-G-B seismic tomography colors [C=RGB]

           split       : Like polar, but via black instead of white [H=0, C=RGB]

           terra       : Colors for global bathymetry/topography relief [R=-7000/7000, H=0, C=RGB]

           topo        : Sandwell/Anderson colors for topography [R=-7000/+7000, H=0, C=HSV]

           viridis     : New colormap Option D from matplotlib [C=RGB]

           world       : Colors for global bathymetry/topography relief [R=-7000/7000, H=0, C=RGB]

           wysiwyg     : 20 well-separated RGB colors [C=RGB]

           ---------------------------------------------------------------------------------------

           [For more, visit http://soliton.vm.bytemark.co.uk/pub/cpt-city/]

           Alternatively, specify -Ccolor1,color2[,color3,...] to build a linear

           continuous CPT from those colors automatically.

        -D Set back- and foreground color to match the bottom/top limits

           in the output CPT [Default uses color table]. append i to match the

           bottom/top values in the input CPT.

        -E Use <nlevels> equidistant color levels from zmin to zmax.

           This option implies we read data from given command-line files [or stdin] to

           determine data range (use -i to select a data column, else last column is used).

           If <nlevels> is not set we use the number of color slices in the chosen CPT.

        -F Select the color model for output (R for r/g/b or grayscale or colorname,

           r for r/g/b only, h for h-s-v, c for c/m/y/k) [Default uses the input model]

           append +c to output a discrete CPT in categorical CPT format.

        -G Truncate incoming CPT to be limited to the z-range <zlo>/<zhi>.

           To accept one of the incoming limits, set that limit to NaN.

        -I Reverse sense of CPT in one or two ways:

           -Ic Reverse sense of color table as well as back- and foreground color [Default].

           -Iz Reverse sign of z-values in the color table (takes affect before -G, T are consulted).【此处便是帮助文档中提到的具体的使用】

        -M Use GMT defaults to set back-, foreground, and NaN colors

           [Default uses the settings in the color table].

        -N Do not write back-, foreground, and NaN colors [Default will].

        -Q Assign a logarithmic colortable [Default is linear].

           -Qi: z-values are log10(z). Assign colors and write z [Default].

           -Qo: z-values are z; take log10(z), assign colors and write z.

                If -T<z_min/z_max/z_inc> is given, then z_inc must be 1, 2, or 3

                (as in logarithmic annotations; see -B in psbasemap).

        -T Give <z_min>/<z_max> to change the z-range for the colorscale in z-units.

           append /<z_inc> to sample the cpt discretely instead, or append +n to <z_inc>

           to let <z_inc> indicate the number of z-values to produce instead.

           Alternatively, supply (1) a filename with custom z-values or

           (2) a comma-separated list of custom z-values.

        -V Change the verbosity level (currently v).

           Choose among 6 levels; each level adds more messages:

             q - Quiet, not even fatal error messages.

             n - Normal verbosity: only error messages.

             c - Also produce compatibility warnings [Default when no -V is used].

             v - Verbose progress messages [Default when -V is used].

             l - Long verbose progress messages.

             d - Debugging messages.

        -W Do not interpolate color palette. Alternatively, append w for a wrapped CPT.

        -Z Create a continuous color palette [Default is discontinuous,

           i.e., constant color intervals]. Without -T or when using -T<z_min>/<z_max> this

           has no effect; the input palette table is used untouched with possible scaling.

        -bi For binary input; [<n>]<type>[w][+L|B]; <type> = c|u|h|H|i|I|l|L|f|D.

            Prepend <n> for the number of columns for each <type>.

        -di Replace any <nodata> in input data with NaN.

        -h[i][<n>][+c][+d][+r<remark>][+t<title>] Input/output file has [0] Header record(s) [OFF]

           Optionally, append i for input only and/or number of header records [0].

             -hi turns off the writing of all headers on output.

           append +c to add header record with column information [none].

           append +d to delete headers before adding new ones [Default will append headers].

           append +r to add a <remark> comment to the output [none].

           append +t to add a <title> comment to the output [none].

             (these strings may contain \n to indicate line-breaks)

           For binary files, <n> is considered to mean number of bytes.

        -i Sets alternate input column order and optional transformations [Default reads all columns in order].

        -^ (or -) Print short synopsis message.

        -+ (or +) Print longer synopsis message.

        -? (or no arguments) Print this usage message

        (See gmt.conf man page for GMT default parameters).

【gmt小技巧@我是水怪的哥----2021-12-26】

GMT中翻转色度条的颜色的评论 (共 条)

分享到微博请遵守国家法律