Topic: Running plot

I am on a Macintosh. When my program runs it would be very nice to have feedback on how it is doing, or if it has gotten hung up. In the past I have gotten both by having the program make a running plot, that it plotting some basic results on the screen as the program runs. How do I do that in Simply Fortran for the Mac? I only need 5 routines: Open a plotting window, change the pen color, move the pen, draw a line, and close the window.

Re: Running plot

This works well for me.  http://gnuplot.info/ You just have to write the plot data to a file in the format gnuplot likes which is really simple.  I mostly write motion control programs using FORTRAN for CNC machines, so I use WPCVIEW for sanity checks.

3

Re: Running plot

I do not think that will work for me. Even if the data file is linked to gnuplot, the data does not appear in the data file when fortran executes a write statement, it is held in a buffer, sometimes until the program terminates. I want the plot to appear step by step, as the fortran program runs. A good analogy would be: Think of writing a game in fortran with simple vector graphics. You want the graphics to appear instantly, not after it has been buffered, written to a file, then read by another code.

4

Re: Running plot

Hibbs wrote:

How do I do that in Simply Fortran for the Mac? I only need 5 routines: Open a plotting window, change the pen color, move the pen, draw a line, and close the window.

Simply Fortran ships with a plotting package, but it does not support running graphs or closing/replacing existing ones on macOS, so that won't work.  You would need a third-party plotting library.

Hibbs wrote:

I do not think that will work for me. Even if the data file is linked to gnuplot, the data does not appear in the data file when fortran executes a write statement, it is held in a buffer, sometimes until the program terminates.

Indeed the output is buffered.  You can, however, use the GNU extension FLUSH to force a unit to flush to disk or screen (depending on the unit).  Writing to a data file that GNUPlot reads might be preferable to trying to directly integrate or call a library just due to the simplicity.

Jeff Armstrong
Approximatrix, LLC