-
Notifications
You must be signed in to change notification settings - Fork 156
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
Heatmap polygon triangles don't meet exactly #44
Comments
Hi @JoshuaMeyers, Thanks for the report. Can you post a screenshot/image, and if possible, a small data set that reproduces the issue? |
Hey Marc, Sorry that was a lazy report! If you zoom in on this image. You will see that the corners of the triangles do not meet each other. Hope this is more helpful.
|
Thanks. Some of this is simply because of how matplotlib draws lines. I may be able to fix the corners. The other edge artifacts are because of the line width of the border -- the thickness of the border lines are covering up part of the corners of the interior colored trianges. This could be fixed by slightly moving the lines outward by the line-width. I'll have to think about how to do that for an arbitrary scale factor. You might have better results in the meantime by setting the border to have smaller line-width. As for the odd interior overlaps, I'll have to investigate cause -- I suspect it's something like rounding errors on the polygon coordinates. |
This could be related to this matplotlib error: matplotlib/matplotlib#2935 |
I was able to fix the overlap of the triangles in the interior by replacing https://github.com/marcharper/python-ternary/blob/master/ternary/heatmapping.py#L260 ax.fill(xs, ys, facecolor=color, edgecolor=color) with ax.fill(xs, ys, facecolor=color, edgecolor=color, linewidth=0.01) I think the problem is, that the At least for my small toy example setting the |
Setting ax.fill(xs, ys, facecolor=color, edgecolor=None) It's also worth noting that this also solves an issue that I encountered when trying to resize the PDF version of this plot in Adobe Illustrator. Illustrator does not resize lines by default but does resize shapes. So when you shrink the ternary heatmap, the stroke widths on the lines stay the same; exacerbating the non-overlapping shapes issue. |
Hey Marc,
Lovely library. I've used it to make some great heatmaps from a data dictionary.
Just thought I'd file a bug report as the triangles don't quite match up if you zoom in - its really noticeable if you remove gridlines and have a low scale.
Cheers,
J.
The text was updated successfully, but these errors were encountered: