Skip to content

Slow curve rendering on HiDPI screens: use a cosmetic pen for curves of width 1 or less #80

Closed

Description

@PierreRaybaut

Part of DataLab-Platform/DataLab#453 (curve readability).

Symptoms

With high-DPI scaling enabled (Windows at 125 % or 150 %), a curve with a line width of 1.0 is drawn 1.25 or 1.5 device pixels wide. Qt's raster engine then takes its slow path for wide pens: with antialiasing, drawing a noisy 2000-point curve takes ~800 ms at 150 % instead of ~2 to 3 ms with a one-device-pixel pen (Qt 5.15, measured with QPainter.drawPolyline on a QImage).

Noisy curve, 2000 points, antialiased 100 % 150 %
Width 1.0 (current pen) 1.6 ms 790 ms
Width 1.0, cosmetic pen 1.6 ms 2.8 ms

Proposed change

Curves (and error bars) whose line width is 1 or less use a cosmetic pen, i.e. a pen whose width is expressed in device pixels and is not affected by the device pixel ratio. The stored width (LineStyleParam.width) is unchanged.

A configuration option (plot section, curve/cosmetic_hairline, enabled by default) restores the previous behavior.

Activity

  1. PierreRaybaut commented on Oct 29, 2026

    @PierreRaybaut
    ContributorAuthor

    Fixed by #81 (merged into develop, will be released in PlotPy 2.12.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions