Skip to content

take a long time to plot dashed vlines #16758

@tomii9273

Description

@tomii9273

Bug report

It takes a long time when I plot long not-solid vline, set short ylim and save it.
The same bug happens at hline and xlim.

Code for reproduction

import matplotlib.pyplot as plt
import time

ymax = 1e7

plt.figure()
plt.ylim(0, ymax)
plt.vlines(0, ymin=0, ymax=ymax, linestyles='dashed') 

t0 = time.time()
plt.savefig("test_0")  # short time
t1 = time.time()
print("{:.2f} [s]".format(t1 - t0))

plt.ylim(0, 1)

t2 = time.time()
plt.savefig("test_1")  # long time
t3 = time.time()
print("{:.2f} [s]".format(t3 - t2))

Actual outcome

0.07 [s]
93.95 [s]

Matplotlib version

  • Operating system: Windows 10 Pro (64 bit)
  • Matplotlib version: 3.0.3
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.6.8
  • Jupyter version (if applicable): jupyter core: 4.5.0, jupyter-notebook: 6.0.0

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