-
Notifications
You must be signed in to change notification settings - Fork 187
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
mark initializers #801
mark initializers #801
Conversation
87c8e42
to
7a47351
Compare
#803 for the radius of hexagons |
#804 tries to implement hexbin as an options transform (adding an initializer) |
4176c9a
to
4a1e110
Compare
Re: the name radius, I scoured the documentation of other libraries quickly and found that (I may have missed some information):
In that regard, Plot's approach of binning in screen space is rather unique (and imho preferable). (Note that some of these libs also offer a choice of orientation (pointy-top vs flat-top); we could do arbitrary orientation.) Overall this doesn't tell us which name to use if we want to move away from radius—only a few names to avoid :) |
Still on the todo-list
Ready:
|
Browsed a base of synonyms, here are a few words that could replace layout: design, layout, encoding/encode, variation/variant, derivation, profile, blueprint, organization, plan, outline, formation, pattern, construction, structure, disposition, makeup, skeleton, anatomy, architecture, stencil, markings, mold, cast, stamp, arrangement/arrange. In bold a few of the ones that could "work". |
For the hexbin radius, another name could be the step (ie distance between neighboring hex centers); however in that case it should be sqrt(3) times the current radius. But it might be easier to explain! |
For composition of initializers, see #818 |
I've added refs to several pull-requests in the original description. |
b305131
to
886615b
Compare
I have extensively reviewed (and amended) this PR and plan on merging tomorrow. If anyone wishes to make any final words before I merge please speak now! 🙏 |
This should be a generic issue (in my view the axes should be displayed on top of areas and below lines… which is neither top nor bottom). Also we could use |
I’ve reverted the default sort by descending r for the hexbin transform because it feels like it should be handled more appropriately at the dot mark level, or possibly at the generic mark level. And in a sense it is already by the basic sort transform, but that isn’t supported after an initializer, and maybe we want to have default sorting for dots, too. |
This introduces a concept of a mark “initializer” which is allowed to redefine the mark’s (possibly faceted) index and channels, and by extension, the plot’s scales. The mark’s initialize option is a function that is passed the facets and channels returned previously by mark.initialize, and returns an object which may specify new facets and channels. This PR includes an example of implementing hexbins as an initializer. This is a refinement of the previous design of “layouts” #648 #711 #713 #740 #775; I wanted to move away from the term “layout” since it implies position whilst initializers are more generic. But I am open to going back to “layout” or other alternatives.
Building on #799, this also makes a few improvements to internal APIs:
While it is possible to call mark.initialize externally and hence this could be considered a backwards-incompatible change, this method is undocumented so I think it is acceptable to make this change. Also, it is now more convenient for debugging.
TODO:
Throw an error if initializers define new positional (x and y) scaled channels?Not going to worry about it.Implement the filter option for the hexbin transform (to show empty hexbins)?Not now.