Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use colorblind-friendly colors in the scatter plots gallery example #1013

Merged
merged 7 commits into from
Apr 12, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/gallery/plot/scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
projection="X10c/10c",
frame=["xa0.2fg", "ya0.2fg", "WSrt"],
)
for color in ["blue", "orange", "green"]:
for color in ["seagreen2", "chocolate1", "mediumpurple1"]:
Copy link
Member

@michaelgrund michaelgrund Mar 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for color in ["seagreen2", "chocolate1", "mediumpurple1"]:
for color in ["seagreen2", "chocolate1", "mediumpurple1"]:

Not sure if these colors solve the problem (please correct me if I'm wrong). Maybe it would be better to select colors from cpts that really focus on the color blindness issue.

Here's a deuteranopia (green-blind) simulation of your example @vitorgt:

deuteranopia

By the way, here's a nice article about the use (or misuse) of color in scientific visualization by Crameri et al.: https://www.nature.com/articles/s41467-020-19160-7.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but colorblind friendly colorschemes are very limited, and transparency makes this case even worst, I've changed green to a grey, this change will produce greater differences on protanopia and deuteranopia, but purple will get closer to grey on tritanopia (the rarest of the three).

Everywhere i looked on how to choose colorblind friendly colors they say not to rely only color, but to create other ways to differentiate set, usualy changing marker. So i added this.

Also, i couldn't find colorblind friendly cpts on gmt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transparency makes this case even worst,

Perhaps we can try to increase the transparency slightly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transparency makes this case even worst,

Perhaps we can try to increase the transparency slightly?

Agree, perhaps transparency=50 gives a better result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, @michaelgrund, "transparency makes this case even worst" means we sould remove transparency.
Like transparency=90 or remove that line completely (which would be equal to transparency=100 (default)).

Transparenncy makes it worst beacuse it blends the colors and changes their luminance when adding two or more symbols with equal or different colors, notting that color addition with colorblindness is a little bit tricky. That's why transparency should be avoided if we want it more coverage considering colorblindness.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're getting a bit confused here. transparency=0 means opaque while transparency=100 means invincible. We probably want to reduce transparency (i.e. increase opacity).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right @weiji14. I think we should not drop transparency here since it allows to deal with overplotting.

x, y = np.random.rand(2, n) # random X and Y data in [0,1]
sizes = np.random.rand(n) * 0.5 # random size [0,0.5], in cm
# plot data points as circles (style="c"), with different sizes
Expand Down