Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Major speed regression introduced in "plt.bar" definition clipping between 3.0.3 and 3.3.0. #17974

Closed
Milestone
@KelSolaar

Description

@KelSolaar

Bug report

Bug summary

As I updated Matplolib from version 3.0.3 to version 3.3.0 I noticed thatColour unit test time skyrocketed: our plotting sub-package test suite went from 120 seconds to around 3000 seconds!

I quickly noticed that it was related to definitions using the spectrum plot:

image

This definition is usingplt.bar and as I suspected that polygon clipping might be the culprit, I ran some tests on one of the offending definitions while keeping and removing the polygon clipping:

With Polygon Clipping

>>>importtimeit>>>importcolour>>>timeit.timeit(lambda :colour.plotting.plot_single_illuminant_sd(filename='test.png'),number=1)59.81594165299998

Without Polygon Clipping

>>>importtimeit>>>importcolour>>>timeit.timeit(lambda :colour.plotting.plot_single_illuminant_sd(filename='test.png'),number=1)1.3159556400000056

Code for reproduction

I haven't created a reproducible case but my assumption is that the clipping code is orders of magnitude slower than before, the definition I used is available here:https://github.com/colour-science/colour/blob/d5f68005f62fc86ba59745bd4c8bb8a01bb5dcb4/colour/plotting/colorimetry.py#L183 and the meat is roughly as follows:

polygon=Polygon(np.vstack([            (x_min,0),tstack([wavelengths,values]),            (x_max,0),        ]),facecolor='none',edgecolor='none')axes.add_patch(polygon)padding=0.1axes.bar(x=wavelengths-padding,height=max(values),width=1+padding,color=colours,align='edge',clip_path=polygon)

There are roughly 450 wavelengths and each one of them generates a coloured bar.

Matplotlib version

  • Operating system: macOS 10.15.5
  • Matplotlib version: 3.3.0
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.8
  • Jupyter version (if applicable):
  • Other libraries:

Matplotlib was installed with Pip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp