Skip to content

Default to color bars with gaps for categorical CPTs#7831

Merged
PaulWessel merged 2 commits intomasterfrom
colorbar-categorical
Sep 23, 2023
Merged

Default to color bars with gaps for categorical CPTs#7831
PaulWessel merged 2 commits intomasterfrom
colorbar-categorical

Conversation

@PaulWessel
Copy link
Member

@PaulWessel PaulWessel commented Sep 23, 2023

See #7830 for background. This PR implements the change. Old (and in our opinion wrong) behavior can be retained by just giving -L with no or zero gap.

Part 1 (implementation) is done
Part 2 (hence WIP) is to update some scripts that currently plot no gaps. I will let a few of those add **-**L so the PS does not change but at least one should give the new behaviour and I will dvc that plot only.

Closes #7830.

See #7830 for backfround.  This PR implements the change.  Old (and in our opinion wrong) behavior can be obtained by just giving -L with no or zero gap.
@PaulWessel PaulWessel added the enhancement Improving an existing feature label Sep 23, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Sep 23, 2023
@PaulWessel PaulWessel requested a review from joa-quim September 23, 2023 09:48
@PaulWessel PaulWessel self-assigned this Sep 23, 2023
@PaulWessel PaulWessel changed the title WIP Default to color bars with gaps for categorical CPTs Default to color bars with gaps for categorical CPTs Sep 23, 2023
@PaulWessel PaulWessel added the add-changelog Add PR to the changelog label Sep 23, 2023
@PaulWessel PaulWessel merged commit 3258db4 into master Sep 23, 2023
@PaulWessel PaulWessel deleted the colorbar-categorical branch September 23, 2023 10:34
@seisman
Copy link
Member

seisman commented Sep 24, 2023

It's likely this PR breaks GMT_App_M_1c:

GMT_App_M_1c

@PaulWessel
Copy link
Member Author

Sure, can see why. But what is a good solution here? This is a page of all categorical CPTs but we treat them as any other CPT. Perhaps it should look different since it is categorical and the script has to adjust. In M_1a we have the paired.cpt who is the same kind, but it is also placed in M_1c so we should remove it so it does not show twice. For all of those the "top continuous, bottom discrete" makes no sense anyway so best to just show those in a separate (new) format. Agree? Thoughts on this, @joa-quim ?

@PaulWessel
Copy link
Member Author

@Esteban82, could you please send me the Rust to Silver CPT from Mercury(?). I cannot find it but I know I kept it....

@joa-quim
Copy link
Member

joa-quim commented Sep 24, 2023

I have never played with the categorical before and so I'm in the learning process. My doubt is even more basic. What are those SCM categorical cpts good for? They look absolutely useless to me. Who wants 100 classes? And if we interpolate them to small number (8 in the bottom palettes) the result is garbage with several classes with indistinguishable colors.

Edit: sure they look garbage. Categorical cmaps are not interpolable

@PaulWessel
Copy link
Member Author

All true. I am reducing to 25 cases and 12 for our paired.cpt. We are just passing SCM to users who hate rainbows and turbo.

@joa-quim
Copy link
Member

Right for the SCM's, but the SCM's-S (the categoricals) are garbage to me (until I'm instructed on its validity) and we should simply drop them, as well as the GMT_App_M_1c figure.

@PaulWessel
Copy link
Member Author

No reason to do so. It does let people see them.

@joa-quim
Copy link
Member

They can be see in GMT_App_M_1b. If they are absolutely useless as, until further proof, is the case there is no reason to show them. On the contrary, there is a compelling reason to not show them.

@PaulWessel
Copy link
Member Author

I sense your anger so WTF, we will trash 1c. I am angry too, spent 90 minutes on fixing that plot!

@joa-quim
Copy link
Member

joa-quim commented Sep 24, 2023

You should know that Sunday lunches here last for long. You should had asked my thoughts only after I had time to do a little siesta 😄

@Esteban82
Copy link
Member

Esteban82 commented Sep 25, 2023

@Esteban82, could you please send me the Rust to Silver CPT from Mercury(?). I cannot find it but I know I kept it....

Hi Paul. Here is the CPT (I add the extension .txt so I can upload it here). RustToSilver_180207.cpt.txt

I used this script to create it from the original CLR file. If you want to use it for pluto, them you only will have to adjust the values (I think).

CLR=RustToSilver_180207.clr
CPT=$(basename $CLR .clr).cpt

# 1. Get values from CLR file
gmt convert $CLR -hi1+d -o0  > values.txt

# 2. Get colors (RGB values) from CLR file
gmt convert $CLR -hi1+d -o1-3  | sed 's/\t/\//g' > colors.txt

# 3. Rearrenge boths lists
colors=$(cat colors.txt | tr -s "\n\r" "," | sed 's/,$//')
values=$(cat values.txt | tr -s "\n\r" "," | sed 's/,$//')

# 4. Create continuos CPT
gmt makecpt -C$colors -T$values -Z > $CPT

rm values.txt colors.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatically select -Lgap layout in colobar if categorical CPT

4 participants