|
21 | 21 | def test_plot_highdpi():
|
22 | 22 | """Curve plotting test with high DPI"""
|
23 | 23 |
|
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 |
27 | 30 | os.environ["QT_SCALE_FACTOR"] = "2"
|
28 | 31 |
|
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) |
30 | 35 | y = np.sin(np.sin(np.sin(x)))
|
31 | 36 | with qt_app_context(exec_loop=True):
|
32 | 37 | _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, |
34 | 43 | wintitle=test_plot_highdpi.__doc__,
|
35 | 44 | title="Curves with high DPI",
|
36 | 45 | plot_type="curve",
|
|
0 commit comments