# Ascii art plotting in Fortran

**URL:** <https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231>\
**Category:** Uncategorized\
**Created:** [May 14, 2021, 4:37pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231 "2021-05-14T16:37:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [May 14, 2021, 4:37pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/1 "2021-05-14T16:37:07Z")

</div>

I would like to have a library like Julia has for ascii art plotting and I would like to be able to do this in Fortran:

[https://twitter.com/gabrielweymouth/status/1393214212219023371](https://twitter.com/gabrielweymouth/status/1393214212219023371)

There is a whole animation on the link above, but one still image looks like this:

![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/389f874d48339dfb2830fb57e61196cf5c00a2ee.png)

The [original plot](https://twitter.com/topher_batty/status/1391827676369932294) from 1973 is done in F66 I assume:

 ![](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/029979227e0280b1aee9691bceb51d244d424a7a.png)

I don’t have time to do this myself, but if anyone is looking for a project, this would be very useful!

---

<div class="post-metadata">

**Author:** ![vmagnin](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/vmagnin/32/28_2.png) [@vmagnin](https://fortran-lang.discourse.group/u/vmagnin)\
**Post date:** [May 14, 2021, 5:11pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/2 "2021-05-14T17:11:59Z")

</div>

@certik , I have found that Fortran small library (160 lines):  
[https://sites.google.com/site/akohlmey/random-hacks/text-mode-graphics-for-fortran](https://sites.google.com/site/akohlmey/random-hacks/text-mode-graphics-for-fortran)

The code is a the bottom of the page (text\_viz.f90.gz). I have not tested it and don’t know if you can make an animation (but probably).

This is the header of the module:

> ! small module to do text mode graphics using ANSI terminal escape sequences  
> ! Copyright (c) 2013 Axel Kohlmeyer [akohlmey@gmail.com](mailto:akohlmey@gmail.com)  
> ! v0.1 2013-06-22, initial public version  
> ! v0.2 2013-06-24, better autoscale and overflow protection
> 
> MODULE text\_viz

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [May 14, 2021, 5:42pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/3 "2021-05-14T17:42:43Z")

</div>

Clever, it just normalizes the value and chooses a proper character for it from

```auto
  CHARACTER, PARAMETER :: plot(0:maxplot) = (/ &
      ' ', '.', ',', ':', '=', '+', 'o', 'x', 'X', '#', '@' /)

```

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [May 15, 2021, 7:47pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/4 "2021-05-15T19:47:06Z")

</div>

> [@certik](#):
>
> The [original plot](https://twitter.com/topher_batty/status/1391827676369932294) from 1973 is done in F66 I assume:

There’s a copy of the paper available at [https://math.berkeley.edu/~chorin/jfm73.pdf](https://math.berkeley.edu/~chorin/jfm73.pdf)

The calculations were done on a [CDC 6400](https://en.wikipedia.org/wiki/CDC_6000_series#Versions), but there is no mention of the programming language (the paper does say the computer program is available from the author).

---

<div class="post-metadata">

**Author:** ![mecej4](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/mecej4/32/855_2.png) [@mecej4](https://fortran-lang.discourse.group/u/mecej4)\
**Post date:** [October 19, 2021, 11:26pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/5 "2021-10-19T23:26:08Z")

</div>

> [@ivanpribec](#):
>
> … CDC 6400, but there is no mention of the programming language

It was most probably [Fortran 66](http://bitsavers.trailing-edge.com/pdf/cdc/cyber/lang/fortran/60101500B_6600_Programming_System_Vol3_FORTRAN66_1965.pdf) (Fortran IV with some extensions). The CDC 6000 series were excellent computers for obtaining numerical solutions of physical problems. Some of the CDC installations had, in addition, the student oriented MNF computer, which was faster to compile, and gave better diagnostic messages. Users typically developed and debugged their programs using MNF first, and then switched to the CDC Fortran compilers (RUN, FUN and FTN) for faster execution.

The assembly language was [COMPASS](http://ygdes.com/CDC/Grishman_CDC6000AsmLangPgmg.pdf). (Note the peculiar dedication note in page 3 of the manual. Address registers A6 and A7 were used for writing the contents of registers into central memory. Setting an address into A6 caused the contents of register X6 to be stored into that address.)

Some of the CDC 6000 series computers had Wirth’s Pascal compiler. Some even had an Algol compiler. Unfortunately, Algol programs ran extremely slowly compared to the corresponding Fortran programs.

---

<div class="post-metadata">

**Author:** ![fortran4r](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@fortran4r](https://fortran-lang.discourse.group/u/fortran4r)\
**Post date:** [October 19, 2021, 11:34pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/6 "2021-10-19T23:34:23Z")

</div>

Something like this will be super useful:

> **[GitHub - JuliaPlots/UnicodePlots.jl: Unicode-based scientific plotting for...](https://github.com/JuliaPlots/UnicodePlots.jl)**
>
> Unicode-based scientific plotting for working in the terminal - GitHub - JuliaPlots/UnicodePlots.jl: Unicode-based scientific plotting for working in the terminal

For publication ready figures, we can use Matlab, etc. Having a Unicode plot package in Fortran will be fantastic.

---

<div class="post-metadata">

**Author:** ![alozada](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/alozada/32/298_2.png) [@alozada](https://fortran-lang.discourse.group/u/alozada)\
**Post date:** [October 20, 2021, 12:45pm UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/7 "2021-10-20T12:45:46Z")

</div>

Maybe:

“Lawrence Berkeley Laboratory Annual Report (1976)” [https://www.iaea.org/inis/collection/NCLCollectionStore/\_Public/09/381/9381276.pdf](https://www.iaea.org/inis/collection/NCLCollectionStore/_Public/09/381/9381276.pdf)

![Modern](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/bef9fe00811bfc87517ebe7a812cbfa3e6fa4f3e.png)  
 ![flow](https://global.discourse-cdn.com/free1/uploads/fortran_lang/original/1X/a832b0f4536b39884cc911baa2812a53e29f574f.png)

---

<div class="post-metadata">

**Author:** ![alozada](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/alozada/32/298_2.png) [@alozada](https://fortran-lang.discourse.group/u/alozada)\
**Post date:** [October 28, 2021, 11:59am UTC](https://fortran-lang.discourse.group/t/ascii-art-plotting-in-fortran/1231/8 "2021-10-28T11:59:48Z")

</div>

ANSI Art and ASCII Art: [The world around us - Text Art Animation - ASCII Art - YouTube](https://youtu.be/fvpsHmYnB14)

> **[ANSI Art and ASCII Art - Origins in Standards](https://blog.ansi.org/2019/10/ansi-art-ascii-art-iso-standards-x3-64/#gref)**
>
> You might be an ANSI art and ASCII art expert, but do you know where they come from? Learn more about the specifications that set them here.
