Repository navigation
Draw thick curves as several one-pixel strokes on screen (30-50x faster) - #84
Merged
Merged
Conversation
Qt's raster engine draws pens wider than one device pixel much more slowly than one-pixel pens. On screen (raster engine without scaling transform), opaque solid curves wider than one device pixel are now drawn as several cosmetic one-pixel strokes, offset horizontally and vertically by at most one device pixel from each other, with dash patterns scaled by the line width. The polyline is computed once and the curve is filled once. A noisy 2000-point curve of width 2 now takes about 10 ms instead of 370 ms to draw with antialiasing, with almost the same appearance. Printing, exporting, translucent colors and lines wider than 8 device pixels still use the original pen. The new `curve/fast_thick_lines` option of the `plot` section restores the previous behavior. Closes #82 Assisted-by: Claude Opus 5.5
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #82. Follow-up of #81, part of DataLab-Platform/DataLab#453 (curve readability).
Problem
Qt's raster engine draws pens wider than one device pixel much more slowly than one-pixel pens, which prevents applications from using thicker, more readable curves.
Change
CurveItem.drawLinesuses the newget_thick_line_strokes()helper on screen (raster engine, no scaling transform).THICK_LINE_MAX_STROKES_WIDTH);curve/fast_thick_linesoption of theplotconfiguration section is disabled (enabled by default).Measurements
Noisy curve, 2000 points, width 2, antialiased,
CurveItem.drawSerieson aQImage:Fidelity compared with the original pen (noisy sine curve, widths 1.5/2/3, DPR 1 and 1.5):
Tests
New
plotpy/tests/unit/test_curve_thick_strokes.py:plotpy/tests/unitandplotpy/tests/itemspass locally: 325 passed, 5 skipped.test_edit_point_toolwas deselected because it also fails locally without this change (mouse simulation).