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

**URL:** <https://fortran-lang.discourse.group/t/how-to-use-fortran-gnuplot-to-plot-in-real-time-in-just-one-window/2904>\
**Category:** Uncategorized\
**Created:** [March 7, 2022, 5:15am UTC](https://fortran-lang.discourse.group/t/how-to-use-fortran-gnuplot-to-plot-in-real-time-in-just-one-window/2904 "2022-03-07T05:15:25Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![CRquantum](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/crquantum/32/730_2.png) [@CRquantum](https://fortran-lang.discourse.group/u/CRquantum)\
**Post date:** [June 18, 2022, 6:22am UTC](https://fortran-lang.discourse.group/t/how-to-use-fortran-gnuplot-to-plot-in-real-time-in-just-one-window/2904/18 "2022-06-18T06:22:52Z")

</div>

> [@urbanjost](#):
>
> Later we changed it to to do a popen by calling the C routine and that worked even better; and options for pausing and sleeping between frames and such as mentioned above.

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

> [@Fortran Videos on YouTube](https://fortran-lang.discourse.group/t/fortran-videos-on-youtube/2231/6):
>
> Here are some recent Fortran-related videos. Realtime display with Gnuplot (52:03) by Ge Baolai June 16, 2022 [[Realtime display with Gnuplot] ](https://www.youtube.com/watch?v=A9YPibAEXEE) The TREXIO File format and library (37:17) by Anthony Scemama Jun 13, 2022 [[The TREXIO File format and library] ](https://www.youtube.com/watch?v=mvNREhW22og) TREX stands for “Targeting REal chemical accuracy at the eXascale” Programming in America in the 1950s – Some Personal Impressions by John Backus (1976) (34:34) Jun 10, 2022 [[Programming in America in the 19…](https://www.youtube.com/watch?v=EylBknGtkqA)

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://degenerateconic.com/fortran-c-interoperability.html)  
[https://fortranwiki.org/fortran/show/m\_process](https://fortranwiki.org/fortran/show/m_process)

---

_[View the full topic](https://fortran-lang.discourse.group/t/how-to-use-fortran-gnuplot-to-plot-in-real-time-in-just-one-window/2904)._
