Skip to content

Commit f84224e

Browse files
committed
Updated unit test associated to #10
1 parent efeb57a commit f84224e

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

plotpy/tests/items/test_curves_highdpi.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,25 @@
2121
def test_plot_highdpi():
2222
"""Curve plotting test with high DPI"""
2323

24-
# Performance should be the same with "1" and "2" scale factors:
25-
# (as of today, this is not the case, but it has to be fixed in the future:
26-
# https://github.com/PlotPyStack/PlotPy/issues/10)
24+
# When setting the QT_SCALE_FACTOR to "2", performance is degraded, due to the
25+
# increased number of points to be drawn. As a workaround, we use the downsampling
26+
# feature to reduce the number of points to be drawn.
27+
# We also enable the antialiasing feature to improve the rendering of the curves,
28+
# which is also affected by the high DPI setting.
29+
# See https://github.com/PlotPyStack/PlotPy/issues/10
2730
os.environ["QT_SCALE_FACTOR"] = "2"
2831

29-
x = np.linspace(-10, 10, 5000000) # 5M points are needed to see the difference
32+
npoints = 5000000 # 5M points are needed to see the difference
33+
dsamp_factor = npoints // 50000 # Max 50000 points to be drawn
34+
x = np.linspace(-10, 10, npoints)
3035
y = np.sin(np.sin(np.sin(x)))
3136
with qt_app_context(exec_loop=True):
3237
_win = ptv.show_items(
33-
[make.curve(x, y, color="b"), make.legend("TR")],
38+
[
39+
make.curve(x, y, color="b", dsamp_factor=dsamp_factor, use_dsamp=True),
40+
make.legend("TR"),
41+
],
42+
curve_antialiasing=True,
3443
wintitle=test_plot_highdpi.__doc__,
3544
title="Curves with high DPI",
3645
plot_type="curve",

0 commit comments

Comments
 (0)