8000 GitHub · Where software is built
[go: up one dir, main page]

Skip to content
[Bug]: transform keyword in ax.plot(...) #21008
Closed
@kovalp

Description

@kovalp

Bug summary

The keyword argument transform of the method ax.plot(...) malfunctions with size of the samples greater than 1000.

For example, the following script

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms


ax = plt.gca()

xx = np.linspace(0.0, 4 * np.pi, num=1001)
yy = np.cos(xx)

t = transforms.Affine2D().translate(10.0, 0.0).scale(2.0, 0.5)

lines = ax.plot(xx, yy, transform=t + ax.transData)

plt.show()

Produces an expected figure

Figure_1000

with num=1000

and an empty figure

Figure_1001

with num=1001.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms


ax = plt.gca()

xx = np.linspace(0.0, 4 * np.pi, num=1001)
yy = np.cos(xx)

t = transforms.Affine2D().translate(10.0, 0.0).scale(2.0, 0.5)

lines = ax.plot(xx, yy, transform=t + ax.transData)

plt.show()

Actual outcome

Figure_1001

Expected outcome

Figure_1000

Operating system

Linux

Matplotlib Version

3.4.3

Matplotlib Backend

Qt5Agg

Python version

Python 3.8.7

Jupyter version

No response

Other libraries

No response

Installation

pip

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0