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

Gradient Scale and color #723

Closed
dj-kim opened this issue Oct 10, 2015 · 2 comments · Fixed by #1250
Closed

Gradient Scale and color #723

dj-kim opened this issue Oct 10, 2015 · 2 comments · Fixed by #1250

Comments

@dj-kim
Copy link

dj-kim commented Oct 10, 2015

With regard to gradient scale, I got a problem.

When I set the gradient range from 0 to 20 It work well. But in case of set the range from 4 to 16, the gradient scale doesn't changed. I attached picture about that.

Also, To make continuous color map, I selected 5 color from CN array.
Then is it possible to using all CN color rather than select few color?

cn = linspace(Color.HSV(0,1,1),Color.HSV(250,1,1),150)

I hope to using color like below.

Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient( cn[:])),

But It doesn't work

Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])), >> work
Scale.ContinuousColorScale(minvalue=4 , maxvalue=16 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])), >> Gradient scale doesn't changed.

map2 =plot(
#layer(df, x="x", y="y", color="vel", Theme(colorkey_swatch_shape=:square,default_point_size=(1.5mm),highlight_width=(0.1mm)), Geom.point),
layer(df2, x="x", y="y", color="vel", Theme(colorkey_swatch_shape=:square,default_point_size=(1.0mm),highlight_width=(0.1mm)), Geom.point),
Theme(panel_fill=color("white"),panel_stroke=color("black")), Guide.colorkey("V(km/s)"),
Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])),
Scale.x_continuous(minvalue=-440, maxvalue=-400),Scale.y_continuous(minvalue=-50, maxvalue=0),Coord.cartesian(xflip=true),
Guide.xlabel("R.A. offset (mas)"),Guide.ylabel("Dec. offset (mas)"),Guide.title("42"),
)

2015-10-10 1 13 41
2015-10-10 1 20 08

@protogeezer
Copy link

On Oct 9, 2015, at 10:26 PM, DJ-kim [email protected] wrote:

With regard to gradient scale, I got a problem.

When I set the gradient range from 0 to 20 It work well. But in case of I set from 4 to 16, the gradient
scale doesn't changed.

I found this same problem with the plots I’m doing for a paper - it bugged me enough that I’ve been working on a patch to change the behavior of gadfly to use the values that are supplied by the user - would that solve your problem too?

Also, To make continuous color map, I selected 5 color from CN array.
Then is it possible to using all CN color rather than select few color?

What happens if you just give two color values - the two at the end of the color range you want to use for the gradient? I’ve been working on rectbin and hist2d plots…

maybe there should be two ways of supplying color values for the gradient. (1) just two values maybe calling that a range, and (2) supplying a list of colors as it is now?

cn = linspace(Color.HSV(0,1,1),Color.HSV(250,1,1),150)

I hope to using color like below.

Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient( cn[:])),

But It doesn't work

Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])), >> work
Scale.ContinuousColorScale(minvalue=4 , maxvalue=16 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])), >> Gradient scale doesn't changed.

map2 =plot(
#layer(df, x="x", y="y", color="vel", Theme(colorkey_swatch_shape=:square,default_point_size=(1.5mm),highlight_width=(0.1mm)), Geom.point),
layer(df2, x="x", y="y", color="vel", Theme(colorkey_swatch_shape=:square,default_point_size=(1.0mm),highlight_width=(0.1mm)), Geom.point),
Theme(panel_fill=color("white"),panel_stroke=color("black")), Guide.colorkey("V(km/s)"),
Scale.ContinuousColorScale(minvalue=0 , maxvalue=20 , Scale.lab_gradient(
cn[1],cn[30],cn[60],cn[90],cn[120],cn[150])),
Scale.x_continuous(minvalue=-440, maxvalue=-400),Scale.y_continuous(minvalue=-50, maxvalue=0),Coord.cartesian(xflip=true),
Guide.xlabel("R.A. offset (mas)"),Guide.ylabel("Dec. offset (mas)"),Guide.title("42"),
)


Reply to this email directly or view it on GitHub.

@simleb
Copy link
Contributor

simleb commented Nov 10, 2015

Same issue here. I think the culprit is optimize_ticks which overrides the minvalue and/or maxvalue specified in the colorscale.

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

Successfully merging a pull request may close this issue.

3 participants