2

I am creating a flow chart in tikz and want the font of one of my nodes to be white (it's the one with the black background) but can't figure out how to get that done. Also, my arrow that goes from the input to the surrogate model looks funny. I want it to drop straight down then turn right.

Here is my code:

\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows,chains}

\tikzset{
  startstop/.style={
    rectangle, 
    rounded corners,
    minimum width=3cm, 
    minimum height=1cm,
    align=center, 
    draw=black, 
    fill=gray!30
        },
  process/.style={
    rectangle, 
    minimum width=3cm, 
    minimum height=1cm, 
    align=center, 
    draw=black, 
    fill=blue!30
    },
  decision/.style={
    rectangle, 
    minimum width=3cm, 
    minimum height=1cm, align=center, 
    draw=black, 
    fill=black
    },
  arrow/.style={thick,->,>=stealth},
  dec/.style={
    ellipse, 
    align=center, 
    draw=black, 
    fill=white
    },
}

\begin{figure}[http]
\center
%\resizebox{!}{.8\textheight}{% if required
\begin{tikzpicture}[
  start chain=going below,
  every join/.style={arrow},
  node distance=0.6cm
  ]
\node (start) [decision,on chain,join] {System: y=f(x)};
\node (inputs) [dec,left= 0.5in of start] {inputs: $x1,...,x_n$};
\node (end3)[dec,right= 0.5in of start] {$y$ output};
\draw[arrow] (start) -- node[auto] {} (end3);
\draw[arrow] (inputs) -- node[auto] {} (start);
\node (in1) [startstop,on chain] {Surrogate Model};
\draw [arrow] (inputs.south) |- +(20pt,0) |- (in1.west);
\draw [arrow] (in1.east) -- +(20pt,0) -| (end3.south);
\end{tikzpicture}
%}
\caption{}
\end{figure} 
1
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – erik Nov 16 '15 at 22:07
2

Just add text=white in definition of decision:

  decision/.style={
    rectangle,
    minimum width=3cm,
    minimum height=1cm, align=center,
    draw=black,
    fill=black,
    text=white% <--- added
    },

Upgrade: I suppose, that you like to have arrows as you can see in picture below:

enter image description here

For this picture I only erase surplus int the last line of your MWE -- +(20pt,0):

\draw [arrow]  (in1.east) -| (end3.south);

I also simply definition of arrows to:

arrow/.style={thick,-stealth},
5
  • Specifically, I am referring to this line: \draw [arrow] (inputs.south) |- +(20pt,0) |- (in1.west); – Smitty Nov 16 '15 at 22:14
  • @Smitty, see if upgraded answer is what you looking for. – Zarko Nov 16 '15 at 22:25
  • No, all of the original arrows were in the correct direction.The problem was that the arrow from inputs to surrogate model was going right first, then down, then right. I just wanted it to go down, then right. – Smitty Nov 16 '15 at 22:27
  • @Smitty, than just return order of lines coordinates ... I will correct answer immediately. – Zarko Nov 16 '15 at 22:28
  • Never mind, I figured it out, I just made it: \draw [arrow] (inputs.south) |- (in1.west) – Smitty Nov 16 '15 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.