Creating diagrams in ASCII

I am looking for a program which I can use to create ASCII diagrams such these:

    +---------+
    |         |                        +--------------+
    |   NFS   |--+                     |              |
    |         |  |                 +-->|   CacheFS    |
    +---------+  |   +----------+  |   |  /dev/hda5   |
                 |   |          |  |   +--------------+
    +---------+  +-->|          |  |
    |         |      |          |--+
    |   AFS   |----->| FS-Cache |
    |         |      |          |--+
    +---------+  +-->|          |  |
                 |   |          |  |   +--------------+
    +---------+  |   +----------+  |   |              |
    |         |  |                 +-->|  CacheFiles  |
    |  ISOFS  |--+                     |  /var/cache  |
    |         |                        +--------------+
    +---------+

It should preferably be a package available in Debian. The wonderful diagram displayed above is taken from the Linux kernel documentation. I cannot believe they were created by hand. There must be some tool to create them.

Asked By: Martin Vegter

||

Have a look at artist-mode or picture-mode for Emacs (see also this screencast). You might also want to check out ditaa.

Answered By: tkrennwa

asciio

I’ve used asciio for several years. Many of the diagrams on this site I’ve created using asciio.

example

  vncviewer         .-,(  ),-.    
   __  _         .-(          )-.           gateway           vncserver 
  [__]|=|  ---->(    internet    )-------> __________ ------> ____   __ 
  /::/|_|        '-(          ).-'        [_...__...°]       |    | |==|
                     '-.( ).-'                               |____| |  |
                                                             /::::/ |__|

The GUI looks like this.

           ss of asciio

NOTE: Everything is driven from the right click menu as well as short-cut keys.

DrawIt

Using vim along with the DrawIt plugin you can also create basic diagrams. A good overview of how to install and use it is available here in this article titled: How To Create ASCII Drawings in Vim Editor (Draw Boxes, Lines, Ellipses, Arrows Inside Text File).

asciiflow

There’s a website called asciiflow which is probably the easiest way to draw these types of diagrams.

   ss #2

JavE

Another tool, JavE, written in Java that can create ascii diagrams like this as well.

                                 ,'''''''''''''|
                                 | Controller  |
                                 |             |
                                 '`'i''''''''''
                                  ,'        `.
                                ,'            `.
                               -                -
                     ,'''''''''''''|      ,''''''''''''`.
                     |    Model    |______|    View     |
                     |             |      |             |
                      `''''''''''''       '`'''''''''''''

The GUI looks like this:

   ss #2

Resources

Answered By: slm

Maybe you will be interested in graph-easy.

Example:

   echo "[ Bonn ] -- car --> [ Berlin ], [ Ulm ]" | graph-easy

produces:

    +--------+  car   +-----+
    |  Bonn  | -----> | Ulm |
    +--------+        +-----+
      |
      | car
      v
    +--------+
    | Berlin |
    +--------+

You can install it with the following commands:

wget http://search.cpan.org/CPAN/authors/id/T/TE/TELS/graph/Graph-Easy-0.64.tar.gz
tar -xzf Graph-Easy-0.64.tar.gz
cd Graph-Easy-0.64
perl Makefile.PL
make test
sudo make install
PATH=$PATH:/opt/local/libexec/perl5.12/sitebin/graph-easy

(Note the version numbers in the two uppermost and the last line – they may change)

Some nice screenshots are available on the pages of lddot and dothost (because both tools are wrappers for graph-easy).

Answered By: Thomas Baruchel

I found another answer; I am not sure it is fully usable, but remember that GNU roff (groff) has a processor for the Pic language as well as an ascii postprocessor; thus you may have a try at something like that (if you use Linux, everything should probably already be installed). Write a file called test.roff containing:

.PS
box "box1";
line
box "box2";
.PE

Then type: groff -Tascii -p test.roff, and you should get:

+------+     +------+
|      +-----|      |
| box1 |     |box2  |
+------+     +------+

Regards.

Answered By: Thomas Baruchel

For anyone using a Mac (not the original poster) there’s a very nice tool called Monodraw. Of course you’re going to pay a few bucks for the fact that it’s highly polished and powerful and intuitive, but if this is something you do often, it’s a handy tool to have available and $10 is peanuts compared to the time you’ll save. If you don’t do this often, there’s a free trial available, so you’re all set. It can even export to SVG

No, I don’t work for the company. I’m just a happy user.

Answered By: iconoclast

I just used https://textik.com/ and it worked great.

Answered By: MarcH

The ADia project aims to render ASCII diagrams using a human-readable language:

diagram: Foo
sequence:
foo -> bar: Hello World!

Output

 DIAGRAM: Foo                             

 +-----+             +-----+
 | foo |             | bar |
 +-----+             +-----+
    |                   |
    |~~~Hello World!~~~>|
    |                   |
    |<------------------|
    |                   |
 +-----+             +-----+
 | foo |             | bar |
 +-----+             +-----+

Read the documentation or Try the live demo page at github.io.

Answered By: pylover
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.