-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Fix CairoMakie heatmap cell sizes #3625
base: master
Are you sure you want to change the base?
Conversation
The heatmap_interpolation.png reference image differs slightly, that's probably why the test failed. If you tell me where to find the code generating the reference output, I can try to fix it. Looks like the pixels within this reference image have variable size; I expected all to be the same, but it's easy to adapt the margin on a per-pixel basis. |
Margins are now calculated per individual pixel, which should get rid of the difference in the test image. |
Ok, I think it's not so easy to get this perfectly right, as padding the pixels is already a bit hacky. As the heatmaps only look wrong if NaN is present, I now check for it and:
|
# Rectangles and polygons that are directly adjacent usually show | ||
# white lines between them due to anti aliasing. To avoid this we | ||
# increase their size slightly. | ||
|
||
|
||
if alpha(colors[i, j]) == 1 && margin_factor > 0 |
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.
What happens if using a transparent colormap here?
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.
The problem mostly goes away, but when you set alpha=0.99 for example, there are still some cases where artifacts occur. For example thin lines that shouldn't be there.
Description
Fixes #3619
CairoMakie heatmap cells are currently enlarged by a constant factor of 0.5. This PR changes this to a value relative to the pixel size.
Before:
After:
There are still some remaining inaccuracies, but its way better than before. This is really important for drawing halfway accurate maps.
Type of change
Delete options that do not apply:
Checklist