-
Notifications
You must be signed in to change notification settings - Fork 12
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
inconsistency in cube_round #13
Comments
Thanks for posted this. I think this is a similar issue that arises when manually trying to hex bin data. Here's a simple example that shows the issue... This is code is based on what's in https://github.com/RalphAS/HexBinPlots.jl and also in Gadfly.jl (https://github.com/GiovineItalia/Gadfly.jl/blob/58fac08c7f1a6c7d7a388c3f7b59fccba6582e49/src/statistics.jl#L1222-L1228) Here's the buggy code, which seems like it ought to work!
Here's the fixed code that manually adjusts the center by xsize
Alternative fixes include offsetting the points before cube_round by xsize, ysize. But yes, I agree it would be nice to have other fixes for this! |
There is an inconsistency in the cube_round function and the coordinate generation of the hexagon, resulting in some unexpected behavior when converting from hexagons to x,y, coordinates and back
A small illustration of this
gives the output:
These are the corners of a hexagon centered around the point (0,0) (default options).
But
center(a)
will givewhich is outside the above listed points (because of the default arguments of
center
).Things get also confused if we to take the above points and infer back the nearest cubic hexagon.
If we do this we we get the following
Note again that this is 'off' as the cube_round function implicitly assumes a center at (1,1) of the
Hexagon(0,0,0)
, as this is the default of thecenter
function -- and there is no way to tell cube_round to avoid doing this. One way to fix this would be to allow passing an argument to cubic_round that sets the (x,y) offset explicitly for the invoked center function. Or make both defaults incenter
andvertices
compatible.The text was updated successfully, but these errors were encountered: