gmt info - T and integer values

Added by Federico 11 months ago

Maybe there is something that I am doing wrong. But gmtinfo -T doesn't give wright values for my plot. How should I use gmt info -T for integer values?

I want to make a map with 3-D column with integer values (in the example data attached only has 0 and 1 values for simplification). So first I run gmt info -T1 and I obtain -T0/1/1. When I make the figure the column of both values have the same color and also the color scale-bar.

gmtinfo "CopaAmerica.csv" -T1+c3
gmt makecpt -Crainbow -T0/1/1 > color
gmt psxyz -R -J -JZ -O -K -p >> OUT "CopaAmerica.csv" -So0.5c -Wthinner -C%color% -i0,1,3,3
gmt psscale -R -J -JZ -O -K -p -C%color% >> OUT -DJRM+o0.3c/0+w13/0.618c -L0.1 -N100

However, I obtain the plot that I want when I add 1 to the maximum value of -T reported by gmtinfo -T1 (-T0/2/1).

gmt makecpt -Crainbow -T0/2/1 > color

CopaAmerica.csv Magnifier - Data (105 Bytes)

Copa_America_T0_2_1.png - Plot that I want (with -T0/2/1) (75.6 KB)

Copa_America_T0_1_1.png - Original Plot (with -T0/1/1) (75.1 KB)

Copa_America_v2.bat - Script for Windows (1.9 KB)


Replies (4)

RE: gmt info - T and integer values - Added by Paul 11 months ago

First, I like your idea. Soccer is important. Second, you are better off if you follow the GMT ascii file model of having all the numerical columns first, followed by trailing text. That way, gmt info can report on the numerical columns and give you NaN for text. If you have to have text columns interspersed with data columns then you would need to use a tool like awk to extract the columns you want and then feed that via gmtinfo. In your case, I think you know that you want -T0/n/1 so better to do the math on that single value and add 1 I think.

RE: gmt info - T and integer values - Added by Federico 11 months ago

Yes, I agree with football (sorry, for me it's not soccer).
Second, I will adopt the GMT ascii file model. Thank you.

Yes, I can add 1 (in this case) but I thought that maybe there is a feature to do this or I was doing something wrong.

Another question, now I try the same script with the categorical master CPT and the scale-bar shows the interval (0-1 and 1-2) for each colour. How could I do to only get the first value (0 and 1)?

gmt makecpt -Ccategorical -T0/2/1 > color

Copa_America_T0_2_1_Categorical.png - Plot that I want with categorical CPT. (75 KB)

RE: gmt info - T and integer values - Added by Paul 11 months ago

Perhaps you need to just to to 1:
gmt makecpt -Ccategorical -T0/1/1 -N

RE: gmt info - T and integer values - Added by Federico 11 months ago

I try (gmt makecpt -Ccategorical -T0/1/1 -N) but it didn't work.

I manually edit the categorical CPT and I managed to get the plot that I want.

gmt makecpt -Ccategorical -T0/2/1 > color -N

Original CPT

0    green
1 blue

Manually modified CPT

0    green   1    green
1 blue 2 blue

Copa_America_CATEGORICAL_original.cpt - Categorical CPT maker with makecpt (15 Bytes)

Copa_America_CATEGORICAL_modified.cpt - Categorical CPT manually modified (30 Bytes)

Copa_America_CPT_Categorical_modified.png - Plot that I want with modified CPT. (74.7 KB)

(1-4/4)