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

Add ContinuousColor and OrdinalColor columns #84

Merged
merged 11 commits into from
May 11, 2023

Conversation

nrbgt
Copy link
Contributor

@nrbgt nrbgt commented May 5, 2023

Checklist

  • the PR target is correct
    • main for releases, docs-only fixes and post-release hot-fixes
    • dev for everything else
  • ran doit lint locally

References

Code changes

  • adds OrdinalColor and ContinuousColor
    • each has a Scheme enum with compatible types
    • ordinal can be overloaded with custom colors in range (not really documented)
  • unit tests
  • robot tests
  • docs

User-facing changes

  • users can now add relatively flexible color scales based on column values
    • domain values have to be known up-front, generally

Screens

note shot
manual image
continuous and ordinal image
strawman image

Backwards-incompatible changes

  • n/a

@github-actions
Copy link

github-actions bot commented May 5, 2023

Try it on ⬅️ ReadTheDocs or Binder ➡️

@nrbgt nrbgt force-pushed the gh-83-color-scale branch 2 times, most recently from 8eb711c to 9d9486f Compare May 5, 2023 21:29
@nrbgt nrbgt mentioned this pull request May 8, 2023
46 tasks
@sanbales sanbales added this to the 0.3.2 milestone May 8, 2023
@sanbales sanbales linked an issue May 8, 2023 that may be closed by this pull request
@sanbales sanbales added the enhancement New feature or request label May 8, 2023
examples/_index.ipynb Outdated Show resolved Hide resolved
@nrbgt
Copy link
Contributor Author

nrbgt commented May 9, 2023

Going to relock here, then dig into tests. Ideally, we'd also hit the categorical ones as well.

@nrbgt nrbgt changed the title Add ColorScaleColumn Add ContinuousColor and OrdinalColor columns May 10, 2023
Copy link
Contributor

@sanbales sanbales left a comment

Choose a reason for hiding this comment

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

Working great! No real concerns, only one minor nitpick comment which I'd be happy to have it ignored.

return validate_enum(proposal, ContinuousColor.Scheme)


class OrdinalColor(Column):
Copy link
Contributor

@sanbales sanbales May 11, 2023

Choose a reason for hiding this comment

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

This is nitpicking to the n-th degree, so apologies in advance, but should this be CategoricalColor (or DiscreteColor)?

My understanding is that ordinal is for discrete values that have an order (e.g., number of wheels: [1, 2, 4]), but categorical is for those things that don't have an order, e.g., car manufacturer: ["Honda", "GM", "Ford"].

I'm confused by the d3-scale-chromatic API though, because in their docs they say these scales are Categorical , but in the code they are under scaleOrdinal?

Again, apologies for the nitpicking...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at the end of the day, things have to be in an order, both on the input and output side.

we're using that for e.g. domain: ["a",false, 3] and range: [red, yellow, blue] would get something, even though the values in either side of the transfer function can't really be compared.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

558a12e adds a manual scale example

@nrbgt nrbgt merged commit 2d7a5f5 into jupyrdf:dev May 11, 2023
nrbgt added a commit to nrbgt/ipyforcegraph that referenced this pull request May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Native continuous colorscales/colormaps
2 participants