I wrote a program like this using Qt. Qt is great once you configure it, but it may take a little effort if you have never used it (like OpenGL, DirectX, etc.).
You can create a QImage and set it to any background color, and then run your program by the pixel width of the image by the pixel that calls your function to get the y value. Roughly speaking:
for (int i = 0; i < imageWidth; i++) { image->setPixel(i, yourFunction(i), lineColor); }
Once you have created your QImage, you can bind it to QLabel using setPixmap (). Once you have connected it, you can display the image in a layout.
source share