How to use Fortran + gnuplot to plot in real time in just one window?

Thank you very much @urbanjost . After watching the first video mentioned by @Beliavsky at,

I noticed that, like you said, using popen may be the best option for Fortran to communicate with Gnuplot. However, at the end the presenter’s code which illustrates Gnuplot drawing real time plot is C not Fortran.

I wonder, may be perhaps when you have time, would you mind sharing a small Fortran code to show how to use popen to call gnuplot and draw a real time plot? Thank much!

PS.
I found two links introduced this popen and Fortran thing a little bit, will investigate it a little bit. But it seems using popen may be the best way to go, if we want to use Gnuplot.
https://degenerateconic.com/fortran-c-interoperability.html
https://fortranwiki.org/fortran/show/m_process