# Foresight, FORtran Easy Svg Interactive Gnuplot-like Html Tool, v0.20.0 is out

**URL:** <https://fortran-lang.discourse.group/t/foresight-fortran-easy-svg-interactive-gnuplot-like-html-tool-v0-20-0-is-out/11341>\
**Category:** Announcements\
**Created:** [November 28, 2026, 8:06am UTC](https://fortran-lang.discourse.group/t/foresight-fortran-easy-svg-interactive-gnuplot-like-html-tool-v0-20-0-is-out/11341 "2026-11-28T08:06:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![szaghi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/szaghi/32/6974_2.png) [@szaghi](https://fortran-lang.discourse.group/u/szaghi)\
**Post date:** [November 28, 2026, 8:06am UTC](https://fortran-lang.discourse.group/t/foresight-fortran-easy-svg-interactive-gnuplot-like-html-tool-v0-20-0-is-out/11341/1 "2026-11-28T08:06:24Z")

</div>

![foresight-logo](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/e/eaf368cb65e7b19b7c2824af2e7aac84b5cbc6a7.png)

> FORtran Easy Svg Interactive Gnuplot-like Html Tool

- Documentation: [foresight](https://szaghi.github.io/foresight/) ([learning paths](https://szaghi.github.io/foresight/manual/), [gallery](https://szaghi.github.io/foresight/guide/gallery), [cookbook](https://szaghi.github.io/foresight/manual/cookbook), [gnuplot subset](https://szaghi.github.io/foresight/guide/gnuplot-subset))
- GitHub: [GitHub - szaghi/foresight: FORtran Easy Svg Interactive Gnuplot-like Html Tool: interactive HTML, SVG and text plots from a Fortran library or a gnuplot-style command line, with no dependency beyond a Fortran compiler. · GitHub](https://github.com/szaghi/foresight)

foresight is a pure Fortran library and a command-line tool. It draws what gnuplot draws, from your solver’s arrays or from a gnuplot script: interactive HTML pages that need nothing but a browser, SVG, PDF with embedded fonts, LaTeX pictures, and text for a terminal. It needs no Python, no gnuplot, and no graphics library: only a Fortran compiler. v0.20.0 is the first release I announce here (written with the help of an AI assistant).

> **Disclaimer: foresight and fplotlib.** [fplotlib](https://github.com/fortran-lang/fplotlib) (fortran-lang) overlaps with foresight in part: both are pure Fortran, both write figures for papers, both set TeX math in labels. They are siblings, not one built on the other, and they differ:
> 
> - **Interface.** fplotlib offers matplotlib’s interface from Fortran. foresight’s interface is gnuplot’s: its command language, interpreted in Fortran, and a Fortran API named after the commands (`fig%set_logscale('y')` is `set logscale y`).
> - **Outputs.** fplotlib writes images, PNG, GIF, and EPS among them. foresight writes interactive pages and vector formats (SVG, PDF, LaTeX pictures), and no raster images at all.
> - **Choose fplotlib** for matplotlib’s style, raster output, or LFortran and flang.
> - **Choose foresight** when your figures are, or should be, gnuplot scripts; when you watch a running job; or when your LaTeX paper should set its own labels.
> 
> foresight takes no code from fplotlib, but it borrows fplotlib’s method of checking a layout against a reference typesetter glyph by glyph. The [comparison page](https://szaghi.github.io/foresight/guide/comparison#foresight-or-fplotlib) has the details. foresight is also young: twenty minor releases in two months, used so far mostly by its author, and its API may still change before v1.0.

![anim_watch](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/7/77addc0b385678a177e5ae2347043288aa41cf38.gif)

_`foresight --watch`: a run’s log grows, and the page redraws, keeping your zoom; the readout shows the latest iteration._

## Three ways to use it

**1. gnuplot, from Fortran.** foresight interprets a large subset of gnuplot 6.0’s language: `plot`, `splot`, `fit`, `stats`, `set table`, functions, loops, datablocks, enhanced text and the 2D styles. Each feature is probed on gnuplot before it is written, and a harness compares gnuplot’s own demo pages, drawn by both programs, page by page. Run your scripts with `foresight script.gp`, or call the same commands from your program. A script can keep running in gnuplot too. A command outside the subset is an error naming its line, never silently skipped.

**2. Watch a running job.** `foresight --watch run.gp` re-renders whenever the solver appends to its log:

- **In the browser,** the page reloads itself and keeps your zoom, or follows the newest data.
- **Over plain ssh,** the plot is redrawn in place in the terminal, with characters, Unicode blocks or Braille dots.
- **On a dashboard,** seven-segment readouts and gauges in the colours of an old car’s display show the numbers you watch for.

**3. Figures for papers and reports.**

- **PDF** written by foresight itself, at the size it is printed (gnuplot’s `pdfcairo` syntax, `size single` for a journal column), with two font families compiled in and embedded.
- **Exact text metrics** on every device, so the SVG, the PDF and the page agree.
- **TeX math in labels** (`$\frac{t}{\tau}$`), laid out as LaTeX lays it out.
- **LaTeX labels:** gnuplot’s `cairolatex`, so your paper’s LaTeX sets the labels in its own fonts.
- **Reports:** `save` returns an alternative text and a caption for each figure, and `set table ... markdown` writes the numbers as Markdown tables.

 ![cb_view3d_lighting](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/3/39409993b2d30589f741592763ab645676954e04.png)

_`splot` as gnuplot draws it: a pm3d surface, depth sorted and lit (`set pm3d lighting`)._

![anim_zoom](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/4/4253a74332cc9c0f5efe4d4ed3e5bb95369cced1.gif)

_The interactive page: each zoom regenerates the tick labels by the same rules as the Fortran side, exact decimals at every scale._

![anim_term](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/8/8f53bd0b467f577d8d6f4c3b78004b87958ce2cc.gif)

_The same run over ssh: `foresight --watch -e "set terminal block braille"` redraws the terminal in place._

## A taste

From a solver’s arrays:

```fortran
program taste
use foresight, only : figure_object, I4P, R8P
implicit none
type(figure_object) :: fig
real(R8P), allocatable :: t(:)
integer(I4P) :: i

t = [(0.05_R8P * i, i = 0, 200)]
call fig%set_title('A damped oscillation')
call fig%set_xlabel('time [s]')
call fig%plot(t, exp(-0.3_R8P * t) * cos(2.0_R8P * t), title='u(t)', lw=2.0_R8P)
call fig%plot(t, exp(-0.3_R8P * t), title='envelope', dt=2_I4P)
call fig%save('taste.html') ! .svg, .pdf, .tex, .txt: the extension picks the format
endprogram taste

```

or from the log it writes, with a gnuplot script:

```gnuplot
set logscale y
set format y '10^{%L}'
plot 'run.dat' using 1:2 with lines title 'continuity', '' using 1:3 with lines title 'momentum'

```

```plaintext
curl -fsSL https://github.com/szaghi/foresight/releases/latest/download/install.sh | bash
foresight --watch residuals.gp

```

The one-line installer builds the latest release with FoBiS or fpm and installs it into `~/.local`, usable through `pkg-config`. foresight is also an fpm and a FoBiS dependency.

 ![qs_library](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/e/e3890d7243d2fc45d026de209d526aebac77598f.png)

_The [installation page’s](https://szaghi.github.io/foresight/guide/install#use-the-library) library example: two panels, three line styles, a log axis with enhanced-text exponents._

## A few more from the gallery

 ![cb_vfd](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/a/a878c55ce8d4cef28e779e6915e866ed9196b5db.png)

_A run monitor in the vacuum-fluorescent theme: readouts, segmented bars, residuals._

 ![cb_math](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/5/588e27ebbd01f1ff000d122c151cbc524ed117d7.png)

_TeX math in the axis labels and the key, in Latin Modern Math._

 ![pd06](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/6/622dc8b0d3695714cd0d74129ea33470e64f20d8.jpeg)

_An isosurface of a voxel grid (`set vgrid`, `vfill`, `with isosurface`)._

 ![cb_complex_phase](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/8/8579df2012faa3289c0abb9c0227bb8cec024ae6.png)

_A complex function over the plane, coloured by its phase._

 ![cb_windrose](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/9/99c89a86fed7a5460a39277df5b7087aab9f021b.png)

_A wind rose of sectors._

 ![pc04](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/2X/d/dc2e869851eacf871bbf18a9c56e9a2eb5612009.png)

_Two panels across a page, in Latin Modern: a figure a LaTeX paper takes as it is._

The [gallery](https://szaghi.github.io/foresight/guide/gallery) has all 226 cookbook plots, by category, each with its script in the cookbook.

## How it is checked

- **Tests:**
  - 18 test programs and 190 golden files compared byte for byte, on every push;
  - gfortran 16.2, nvfortran 26.9 and Intel ifx 2026.2, debug and optimised.

- **Against gnuplot:**
  - a harness draws gnuplot 6.0’s own demo scripts with both programs, rasterizes every page and scores the difference;
  - a change may not make a page worse.

- **Against LaTeX:**
  - the math layout is checked glyph by glyph against LuaLaTeX;
  - the PDFs are checked with `qpdf`, `pdffonts` and `pdftotext`;
  - the example paper is built by the CI with Tectonic.

- **Docs:** every snippet, output, and plot in the documentation comes from a program the CI compiles and runs.
- **Honest limits:**
  - the [gnuplot subset](https://szaghi.github.io/foresight/guide/gnuplot-subset#not-supported) lists what is not supported;
  - the [comparison](https://szaghi.github.io/foresight/guide/comparison#layout-compared-with-gnuplot) lists where the layout departs from gnuplot’s.

## A family of tools

foresight is one of three projects with one goal: a Fortran program, from the running solver to its paper, with no runtime but its own.

- **[FIGURE](https://github.com/szaghi/figure)**, Dear ImGui and ImPlot for Fortran, is the interactive side: windows, widgets, live plots.
  - It already builds on foresight: its tick labels come from foresight’s number formatter and tick module, so they are the same digits on gfortran, nvfortran, and ifx.
  - Its plots can take foresight’s gnuplot tick rule later.

- **[BARUCH](https://github.com/szaghi/BARUCH)**, a pure Fortran CommonMark reader and writer, is the reports side.
  - foresight is one of its first clients: once BARUCH’s streaming writer is released, the reports of foresight’s path F will be written through it instead of plain `write`, and its pages will read Markdown.
  - foresight does not depend on BARUCH: what a report needs of a figure is in `figure_info` already.

* * *

foresight builds with FoBiS or fpm, and its only dependencies are my own Fortran libraries (PENF, BeFoR64, FACE, StringiFor), fetched by either. It runs on Linux and other POSIX systems; on Windows, run it in WSL 2. It is available under your choice of license: GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT. The compiled-in fonts keep their own licenses (SIL OFL 1.1, GUST Font License).

Coming next: text placed exactly where gnuplot places it, with equal plot areas, on every device ([#6](https://github.com/szaghi/foresight/issues/6)), and whatever the first users find.

Feedback, issues, and contributions are welcome, and in this phase bug reports most of all.

Stefano
