Noticed this a while ago (while implementing mplcairo) but prompted to report due to #9829:
from matplotlib import pyplot as plt, ticker
fig, axs = plt.subplots(4, 4)
for i, ax in enumerate(axs.flat):
ax.xaxis.set_major_locator(ticker.NullLocator())
ax.yaxis.set_major_locator(ticker.NullLocator())
ax.plot([-1, 0, 1], [0, 1, 0], lw=i, solid_joinstyle="miter")
ax.set(xlim=(-15, 15), ylim=(0, 3))
fig.savefig("/tmp/test.png")
fig.savefig("/tmp/test.svg")
fig.savefig("/tmp/test.pdf")
plt.show()
pdf appears to respect the miter ("pointed") joinstyle (funnily this appears to behave in the opposite manner as #9829):
svg appears to ignore it:
agg changes its mind half-way:
which suggest that the author thought miter_limit takes an absolute miter limit, but in fact a relative miter limit should have been given (how do I know this? because I can reproduce the same behavior with mplcairo with the same setting, and cairo clearly documents that it uses a relative miter limit :-)).
So the current implementation ends up switching from miter join to bevel join at an angle that depends on the linewidth, eek.
NOTE: when this is fixed, remember to regen the logo per #14939 (which also showcases the issue).
The miter_limit is not explicitly set by matplotlib anywhere. Therefore, each backend will end up effectively utilizing whatever the target is (e.g. 4 for SVG, 10 for PostScriptand PDF, etc.)
Agg in particular appears to still treat miter limits incorrectly (I can reproduce this issue on 3.1.3).
So to really deal with this issue, it looks like we'd have to actually add a new rcParam (miterlimit), and have each of the backends respect it (including a simple change in _backend_agg.h to force the Agg backend to treat miter limit as relative, as that is the standard everywhere else).
This bug seems reasonably low priority and high effort? But if I want to correctly handle miter limits in #16607, I would need to add this new rcParam first...
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Activity
brunobeltran commented on Mar 12, 2020
there are two issues here:
So to really deal with this issue, it looks like we'd have to actually add a new rcParam (miterlimit), and have each of the backends respect it (including a simple change in _backend_agg.h to force the Agg backend to treat miter limit as relative, as that is the standard everywhere else).
This bug seems reasonably low priority and high effort? But if I want to correctly handle miter limits in #16607, I would need to add this new rcParam first...
anntzer commented on Mar 12, 2020
I agree that this is pretty high effort/low priority (though see #14939)...
github-actions commented on Apr 25, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
anntzer commented on Apr 25, 2023
Still true, still low priority.
github-actions commented on Jun 12, 2024
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!