-
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
spike vector shape + centroid transforms #1189
Conversation
We need similar Plot.centroid for planar geometries (and when in doubt about the geometries, as a best guess). A custom symbol would be nice, and hopefully shared with the other symbols (those associated with dot). This means two changes:
|
Okay, I have now:
I expect people will incorrectly apply the Plot.centroid transform to spherical geometry when they should be using the Plot.geoCentroid transform. I’m not sure what to do about that; I don’t think it’s possible for the centroid transform to detect that a projection is in use and throw an error or warning. And even if a projection is in use, we don’t know whether it’s a geographic/spherical projection or a planar transform anyway. But I think this is fine for now, and the difference is often imperceptible anyway, as in the spike map example. Please take another look? |
A slight difficulty when documenting, between width and radius. Could we settle on defining just one of them? |
You’re referring to the fact that there’s a width option for the vector mark, whereas a radius is passed to the vector mark’s custom shape? My thinking is that for the user, it’s more intuitive to specify a width (e.g., of the base of a spike) because that’s what you see; whereas for the shape implementor, it’s more intuitive to receive the radius (the offset from the anchor to the respect corners of the base) because that’s what you need to construct the geometry. |
Yes. I understand the intent, but it means that the documentation for the custom shape object needs to explain that radius is half the width, which seems a bit verbose. |
Would you prefer we use radius everywhere? Or r to match dot (even though it won’t support a channel)? |
Any of these work equally. Maybe using r is indeed better since it's a bit more consistent with the rest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the additional geometry option it looks like it's good to go
TIL! but we need to test centroid too :) |
Also for reference here is the equirectangular centroid (green): I guess it’s okay to lose this. Even though it’s “fast”, it’s only right if you’re using the equirectangular projection. Whereas the other two at least have a valid semantic meaning (either the center on the surface of the sphere, or the center on the projected plane). |
* spike, geoCentroid * vector shape, template * planar centroid * document vector and spike * document centroid and geoCentroid * r instead of width * Update README * geometry option; update README * lift size * fancy splice * projected centroid via initializer * Update README * Update README * geoCentroid * geoCentroid is faster, actually * test centroids Co-authored-by: Philippe Rivière <[email protected]>
TODO
Fixes #1178. (The diffs to the tests are just the re-ordering of the aria-label and fill attributes.)
An alternate approach here would be to expose a “shape” option similar to how the dot mark allows you to specify a custom symbol. (The difference being that vector uses length and dot uses area, so you don’t have the confusion around the r sqrt scale.) That’d probably be more flexible and we could still do that in the future, but I thought having a builtin in spike mark would be nice—especially with the default fill and stroke.