Color gradient fill for figures

I share with you a script with 9 color gradient fill that can be used to fill figures (as can be seen in the last subplot). I create a continuous CPT from white to gray and then I used it to paint different 2d surfaces created with grdmath.

#!/usr/bin/env bash

	title=Color_Gradient_Fill
	GRD=temp_$title.nc

#	-----------------------------------------------------------------------------------------------------------
gmt begin $title png

	gmt makecpt -Cwhite,50 -T0/1 -Z

	gmt subplot begin 3x3 -Fs15c/0 -M0.1c -R0/1/0/1 -JX6c -B0wesn -A+jTR+gwhite+p1p+o0.2c/0.2c

#	-----------------------------------
	gmt subplot set 0 -A"Y"

#	Crear Imagen a partir de grilla con sombreado
	gmt grdmath -I0.01 Y = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 1 -A"X"

	gmt grdmath -I0.01 X = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 2 -A"X \327 Y"

	gmt grdmath -I0.01 X Y MUL = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 3 -A"X + Y"

	gmt grdmath -I0.01 X Y ADD NORM = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 4 -A"X + Y rotated 90 \260"

	gmt grdmath -I0.01 X Y ADD NORM = $GRD
	gmt grdedit $GRD -Er
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 5 -A"Circle CM"

	gmt grdmath -I0.01 0.5 0.5 CDIST NORM = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 6 -A"Circle CM Inverted"

	gmt grdmath -I0.01 0.5 0.5 CDIST NORM NEG 1 ADD = $GRD
	gmt grdimage $GRD -C	
#	-----------------------------------
	gmt subplot set 7 -A"Circle RT"

	gmt grdmath -I0.01 1 1 CDIST NORM = $GRD
	gmt grdimage $GRD -C
#	-----------------------------------
	gmt subplot set 8 -A"Circle RB"

	gmt grdmath -I0.01 1 0 CDIST NORM = $GRD
	gmt grdimage $GRD -C

	gmt histogram -Bxaf -Byaf @v3206_06.txt -R-6000/0/0/30 -Gorange -W1p -Z1 -T250
#	-----------------------------------
	gmt subplot end
gmt end

	rm temp_*
4 Likes

Art of sciences :smiley:

1 Like