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

Colorscales #763

Merged
merged 6 commits into from
Dec 30, 2015
Merged

Colorscales #763

merged 6 commits into from
Dec 30, 2015

Conversation

simleb
Copy link
Contributor

@simleb simleb commented Dec 7, 2015

I added transformed continuous color scales to fix #744 and fix what I think is a typo in asinh_formatter.

It seems to work fine but I am a Gadfly beginner so please make sure I didn't break anything!

@simleb
Copy link
Contributor Author

simleb commented Dec 16, 2015

I'm not sure I understand what made the CI build fail but I'm happy to try fix it if you guide me.


minvalue
maxvalue

function ContinuousColorScale(f::Function; minvalue=nothing, maxvalue=nothing)
new(f, minvalue, maxvalue)
function ContinuousColorScale(f::Function, trans::ContinuousScaleTransform; minvalue=nothing, maxvalue=nothing)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the problem is on this line. Since the trans argument did not exist before, and a default value is not provided, it is breaking any existing code that simply calls ContinuousColorScale(f). Try turning it to trans::ContinuousScaleTransform = identity_transform?

@simleb
Copy link
Contributor Author

simleb commented Dec 18, 2015

That worked, thanks @darwindarak !

@timholy
Copy link
Collaborator

timholy commented Dec 23, 2015

LGTM. But I suspect this could use a test, otherwise your shiny new functionality might get broken by some other well-meaning future contribution 😄.

The general guideline seems to be to add a new file to the test/ folder, with only one rendered display per file. Others can correct me if I'm wrong.

@simleb
Copy link
Contributor Author

simleb commented Dec 24, 2015

I added a single test instead of testing all variants since that seems to be the norm. (I did test them all manually.) I also updated the docs.

There is one more thing I'd like to do but I'd rather ask first: update the docs such that the name color_continuous takes precedence over color_continuous_gradient, for consistency with [xy]_continuous. We could even go one step further and deprecate color_continuous_gradient. Let me know what you think.

@darwindarak
Copy link
Collaborator

I think we should move towards making test-all-variants the norm if possible. Why not?

It seems a little awkward to group all the variants under the docs for continuous_color. It might make more sense to show them as convenience functions for ContinuousColorScale. What do you think?

@simleb
Copy link
Contributor Author

simleb commented Dec 25, 2015

@darwindarak Sure I can add more exhaustive tests, I just didn't want to add too many files.

About the docs, yes and no. I agree that color_continuous might not the best place since they are not arguments but actually alternatives to color_continuous. I did this to mimic the existing doc for x_continuous. However I find it pretty discoverable this way since they are indeed continuous color scales, they are just transformed. And it makes the index of the docs less cluttered than having all variants listed.

Also, it looks very odd to me that ContinuousColorScale is the only camel-cased identifier in the list. It's pretty inconsistent. In my opinion, color_continuous should accept an optional argument corresponding to the f of ContinuousColorScale (renamed to something more meaningful like color_mapping or colormap) and we should remove ContinuousColorScale from the docs. But that should probably be another PR.

@darwindarak
Copy link
Collaborator

That makes sense, so group everything under color_continuous, and deal with ContinuousColorScale later?

@simleb
Copy link
Contributor Author

simleb commented Dec 27, 2015

Sounds good. It's ready to merge then. In a different PR, I'll rename color_continuous_gradient in the docs to color_continuous, update color_continuous to accept ContinuousColorScale's function argument, and remove ContinuousColorScale from the docs. We can discuss if color_continuous_gradient should be deprecated or not in the new PR.

darwindarak added a commit that referenced this pull request Dec 30, 2015
@darwindarak darwindarak merged commit 2ea9744 into GiovineItalia:master Dec 30, 2015
@simleb simleb deleted the colorscales branch December 30, 2015 16:49
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 this pull request may close these issues.

Feature request: logarithmic (continuous) color scale
3 participants