Graphics, Figures & Tablesproblem in drawing flowchart

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
satheesh kumar
Posts: 2
Joined: Wed Aug 06, 2014 1:30 pm

problem in drawing flowchart

Post by satheesh kumar »

Hello, i am having problem in drawing a flowchart using tikz package.
It seems, all the text boxes are aligned at the top of the page, irrespective of the node position. The attachment is the latex output of a simple tikz flowchart example.

Code: Select all

\documentclass{article}
\usepackage{flowchart}
\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,
      text width=3em, 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}
Please help me.
Attachments
simple-flow-chart.dvi
(15.3 KiB) Downloaded 381 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: problem in drawing flowchart

Post by Johannes_B »

Dvi files are not suppposed to be looked at. You can do it, but often you see something strange. Use dvips -> ps2pdf to convert your file to pdf and look at it. Or use pdflatex in the first place, directly outputting a pdf file.

Additional hint: Click on »Open in writelatex« just above your code to see the output.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
satheesh kumar
Posts: 2
Joined: Wed Aug 06, 2014 1:30 pm

Re: problem in drawing flowchart

Post by satheesh kumar »

I am enriched with one more information.
Thanks a lot.
Pravin Prajapati
Posts: 1
Joined: Sun Nov 23, 2014 8:19 am

Re: problem in drawing flowchart

Post by Pravin Prajapati »

Thanks a lot. I faced lots of problem when I insert flow chart code in IEEE transaction latex templet. IT becomes messy. I do not know that after running latex , it must be converted to DVI to PS and PS to pdf . From this post my problem has been solved. Thanks a lot .....
Post Reply