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

colorkey min/max values #1626

Open
montyvesselinov opened this issue Oct 26, 2023 · 1 comment
Open

colorkey min/max values #1626

montyvesselinov opened this issue Oct 26, 2023 · 1 comment

Comments

@montyvesselinov
Copy link

The new version of Gadfly seems to be overriding the min/max values set in color_continuous().

The code below

plot(x=rand(12), y=rand(12), color=rand(12), Scale.color_continuous(minvalue=-1, maxvalue=100)) 

produces a colorkey from -50 to 100.

How to force Gadfly to produce a colorkey from -1 to 100?

@DomHin
Copy link

DomHin commented Dec 12, 2023

I observe something similar with the colorkey values.
Changing from float to int and minvalue maxvalue have no effect anymore.

So my basic advise is actually to use floats with minvalue maxvalue if someone provides these such as in my example p3.
For better clarity in some plots this makes sense to have the colorbar ranging from 0.5 to 3.4 or so instead of 0 to 4.

using Gadfly, Colors

y = [0.1, 0.4, 0.9, 0.3, 0.25, 0.53, 1.1, 1.6, 1.9, 2.5]
p1 = plot(x=[1:1:length(y)...], y=[1:1:length(y)...], color=y, Geom.rectbin,
 Scale.color_continuous(colormap=p->RGB(0,p,0)))

y = [0.1, 0.4, 0.9, 0.3, 0.25, 0.53, 1.1, 1.6, 1.9, 2.8]
p2 = plot(x=[1:1:length(y)...], y=[1:1:length(y)...], color=y, Geom.rectbin,
 Scale.color_continuous(colormap=p->RGB(0,p,0)))

p3 = plot(x=[1:1:length(y)...], y=[1:1:length(y)...], color=y, Geom.rectbin,
 Scale.color_continuous(colormap=p->RGB(0,p,0),minvalue=0.1,maxvalue=2.8))

set_default_plot_size(10inch,4inch)
hstack(p1,p2,p3)

Gadfly_colorkey_values

Is there a reason why the values change from floats to ints (p1 -> p2 if some value is larger)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants