Since I need to plot multiple curves on a single graph but may need to access only the last one I've implemented a small feature that does not clear the background, thus leaves the previous curves plotted.
Using the repaintAll property it is possible to control whether all the layers or just the main one are repainted in QCustomPlot::replot.
I'm not familiar with Gitlab workflow but it does not seem that I'm allowed to create merge requests into main project, however I'd propose this change for inclusion.
See https://gitlab.com/Corbelli/QCustomPlot.git master branch.