Skip to content

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

Closed

Description

@david-hoffman

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.

Activity

  1. ImportanceOfBeingErnest commented on Mar 10, 2019

    @ImportanceOfBeingErnest
    Member

    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?

  2. ImportanceOfBeingErnest commented on Mar 10, 2019

    @ImportanceOfBeingErnest
    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.

  3. ImportanceOfBeingErnest commented on Mar 10, 2019

    @ImportanceOfBeingErnest
    Member

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

  4. added this to the v3.2.0 milestone on Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions