Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Annotation bbox clipping incorrect for boxstyle='round' Matplotlib >= 1.4.0 #4140

Copy link
Copy link
Closed
@joferkington

Description

@joferkington
Issue body actions

Annotations using a bbox boxstyle of "round" have different (incorrect?) clipping behavior compared to a square boxstyle.

As an example, note that with matplotlib 1.4.0, the connector arrow extends inside the round box, while it is clipped for the square boxstyle. With earlier versions, both have the same clipping behavior.

import matplotlib.pyplot as plt
import matplotlib

def main():
    fig, ax = plt.subplots()
    ax.set(title='Matplotlib {}'.format(matplotlib.__version__))
    annotate(ax, 'Round')
    annotate(ax, 'Square')
    plt.show()

def annotate(ax, text):
    bbox = dict(fc='none')
    x, y = 0.1, 0.1

    if text == 'Round':
        bbox['boxstyle'] = 'round'
        y = 0.5

    ax.annotate(text, xy=(x, y), xytext=(50, 50), size=20,
                xycoords='data', textcoords='offset points',
                bbox=bbox,  arrowprops=dict(arrowstyle='->'))

main()

clip_mpl1 3

clip_mpl1 4 0

The problem persists up to and including the current HEAD, but newer versions also have the issue described in #4139 The two issues don't appear to be directly related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.