Skip to content

[ENH]: Scale Invariant Arrow Styling #24272

Closed as not planned
Closed as not planned
@suuuehgi

Description

@suuuehgi

Problem

When using pyplot.arrow, the coordinates x, y, dx, dy are within the same coordinate system than the styling kwargs, resulting in different appearances, when used on multiple plots with different scales.

import matplotlib.pyplot as plt

fig, axs = plt.subplots(nrows=3, layout='constrained')

for ii, ax in enumerate(axs.flat):

    ax.set_xlim( [ ii/5, 1 - ii/5 ] )
    ax.set_ylim( [ .5 - (ii+1)/50, .5 + (ii+1)/50 ] )

    ax.arrow( 1 - ii/5, .5, 2 * ii/5 - 1, 0, length_includes_head=True, linewidth=0, width=.01 )

arrows

transform=ax.transAxes transforms both, placement and appearance, resulting in homogeneous appearance and hard to handle placement.

arrows2

Proposed solution

Having coordinates x, y, dx, dy in data coordinates and styling kwargs in axes coordinates.

(And length_includes_head=True as default cough)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions