Skip to content

joinstyle is not respected for FancyArrowPatch (either the path or the arrow heads) #13641

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

Closed
david-hoffman opened this issue Mar 9, 2019 · 3 comments · Fixed by #13647
Closed
Milestone

Comments

@david-hoffman
Copy link

Bug report

Bug summary

joinstyle is not respected for FancyArrowPatch (either the path or the arrow heads)

Code for reproduction

import matplotlib as mpl
import matplotlib.pyplot as plt

# high dpi so you can see the difference
fig, ax = plt.subplots(dpi=600)

# iterate through styles
for i, js in enumerate(("miter", "round", "bevel"), start=1):
    arrow_head = mpl.patches.ArrowStyle.CurveFilledAB(head_length=4, head_width=2)
    connection = mpl.patches.ConnectionStyle.Bar(fraction=0, angle=-90)
    double_arrow = mpl.patches.FancyArrowPatch((0.1 * i, 1 - 0.1), (1 - 0.1, 0.1 * i), linewidth=2,
                                       arrowstyle=arrow_head, connectionstyle=connection, joinstyle=js)
    ax.add_patch(double_arrow)

Actual outcome

image

Expected outcome

Different join styles for each line (including arrow heads)

Matplotlib version

  • Operating system: Windows 10
  • Matplotlib version: 3.0.2
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version:
Python 3.7.2 (default, Feb 21 2019, 17:35:59) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

I installed with the default conda channel.

@ImportanceOfBeingErnest
Copy link
Member

ImportanceOfBeingErnest commented Mar 10, 2019

The joinstyle and capstyle are fixed for FancyArrowPatch.

# FancyArrowPatch has traditionally forced the capstyle and joinstyle.
with cbook._setattr_cm(self, _capstyle='round', _joinstyle='round'), \
self._bind_draw_path_function(renderer) as draw_path:

I don't know why that is the case. If we remove that line the result would look like this:

image

Is that what you're expecting? Would someone know why that got fixed in the first place?

@ImportanceOfBeingErnest
Copy link
Member

Ok, here is the deal (in a comment by @anntzer):

Yes, ignoring the capstyle was probably a long-standing bug [..] but changing that would result in changes in the baseline images [..]. I'll leave this as it is until someone actually complains or we have some othe reason to change the baseline images.

Actually, I don't quite see why we can't keep "round" as default - in that way no baseline images need to change and it remains backwards compatible - but at the same time allow for user input to change it.

@ImportanceOfBeingErnest
Copy link
Member

A possible fix is at #13647, no changes are made to the defaults and tests pass as they are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants