tool to generate flow chart diagram from textual notation [closed]
Asked Answered
L

2

7

I am looking for a console-based tool that can process a simple text file containing the textual notation of a flowchart diagram and generate a PNG (or other format) file. There might also be a LaTeX package for that but, if possible, I would prefer a tool that can generate an independent PNG which I can then import in a LaTeX document as a graphic.

Loveless answered 23/1, 2015 at 20:44 Comment(0)
W
6

It would be cleaner to let LaTeX generate the flowchart instead of generating/importing a png file. In this way you will not have problems of resolution or undersampling and everything will be in vector format.

You can use the TikZ package of LaTeX. The site texexample.net gives the following example.

enter image description here

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}

% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20, 
    text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, 
    text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,
    minimum height=2em]

\begin{tikzpicture}[node distance = 2cm, auto]
    % Place nodes
    \node [block] (init) {initialize model};
    \node [cloud, left of=init] (expert) {expert};
    \node [cloud, right of=init] (system) {system};
    \node [block, below of=init] (identify) {identify candidate models};
    \node [block, below of=identify] (evaluate) {evaluate candidate models};
    \node [block, left of=evaluate, node distance=3cm] (update) {update model};
    \node [decision, below of=evaluate] (decide) {is best candidate better?};
    \node [block, below of=decide, node distance=3cm] (stop) {stop};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -| node [near start] {yes} (update);
    \path [line] (update) |- (identify);
    \path [line] (decide) -- node {no}(stop);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line,dashed] (system) |- (evaluate);
\end{tikzpicture}
\end{document}
Whitworth answered 7/3, 2015 at 18:28 Comment(1)
the only thing is that producing a PNG file (as opposed to a PDF document) would allow me to use it independently in other contexts as well (e.g. in a web page), i.e. it would produce a more self-contained and reusable artifact.Loveless
G
0

Try this latex graph generator you just need to drag and drop nodes to generate latex code for you

Groupie answered 31/12, 2022 at 11:10 Comment(2)
The link doesn't works.Undenominational
link updated. give it another tryGroupie

© 2022 - 2024 — McMap. All rights reserved.