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

[ENH]: Speed up Axes.bar through the use of PatchCollection #22976

Open
@timhoffm

Description

@timhoffm

Problem

Bar charts are relatively slow because each bar is a separate Rectangle. From a quick check, this scales really linearly with the number of bars N:

N = [30, 100, 300, 1000, 3000, 10000]t = [29, 103, 290, 951, 2860, 9790]  # in ms for `plt.bar(x, y)`

While one should not have too many bars in a plot, possibly up to 1000 could be reasonable. The time delay is still okish herem but if e.g. I have multiple subplots, it can become noticable.

Proposed solution

One possible solution is to replace the single Rectangles by a PatchCollection (inspired by#20092).
For backward-compatibility, we'd have to intoduces this gradually similar to what has been done inhist(..., histtype=...): Add a parameter to make the created Artist configurable. The default stays on isolated bars, using a collection is opt-in. The default can be switched later.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp