Skip to content

Unexpected behavior for Axes.quiver(transform=None) #11153

@timhoffm

Description

@timhoffm

Bug report

Bug summary

I would expect that Axes.quiver(transform=None) would behave the same as leaving out the kwarg transform (None implying default). However this is not the case. Instead the default for a missing transform is Axes.transData.

As far as I understand, there is no reasonable semantics of an explicit transform=None here (except for 'use default'). It's probably an unintended implementation detail.

I therefore propose to change the behavior of Axes.quiver(transform=None) to be the same as leaving out the kwarg. This would allow further code simplification with explicit kwargs (#11145).

Code for reproduction

import matplotlib.pyplot as plt
import numpy as np

X = np.arange(-10, 10, 1)
Y = np.arange(-10, 10, 1)
U, V = np.meshgrid(X, Y)

fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(12, 3))
ax1.quiver(X, Y, U, V)
ax2.quiver(X, Y, U, V, transform=None)
ax3.quiver(X, Y, U, V, transform=ax2.transData)

plt.show()

grafik

Expected: All there Axes should be equal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions