4

I am new to tikzp and need some help in performing this task(representing a moderator). Could somebody help me with my code? How can I extend the length of the arrow? And how to tell tikzp that it should draw this kind of arrow?

What I got:enter image description here

What i want:Wanted

My Code:

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usetikzlibrary{positioning}
\begin{document}


\begin{figure}[h]
\label{illustration}
\centering
\caption{The model}
\begin{tikzpicture}[
node distance=1cm and 1cm,
ar/.style={->,>=latex},
mynode/.style={
draw,
text width=4cm,
minimum height=1cm,
 align=center
 }
]
\node[mynode] (LE) {Level of expertise};
\node[mynode,right=of LE] (PS) {Problem solving time};
\node[mynode,below=of LE] (FI) {Fluid intelligence};


\draw[ar]
  (LE) -> node[above] {-}  (PS);
  \draw[ar]
  (FI) -> node[left] {-}  (PS);
\end{tikzpicture}
\end{figure}
\end{document}
  • You probably need \ominus , for the symbol. Also use calc tikz library and try \draw[->] (FI.east) -| ($(LE)! 0.5!(PS)$); (untested, not at pc) – daleif Nov 14 '16 at 20:24
3

Yet another answer, defining a coordinate on the fly when drawing the arrow from LE to PS.

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}%
  [node distance=1cm and 1cm,
   ar/.style={->,>=latex},
   mynode/.style=
    {draw,
     text width=4cm,
     minimum height=1cm,
     align=center
    }
  ]
  \node[mynode] (LE) {Level of expertise};
  \node[mynode,right=of LE] (PS) {Problem solving time};
  \draw[ar] (LE) -> node[above] {-} coordinate(LE-PS) (PS);
  \node[mynode,below=of LE-PS] (FI) {Fluid intelligence};
  \draw[ar] (FI) -> node[left] {-}  (LE-PS);
\end{tikzpicture}

\end{document}

enter image description here

3

use calc library and ($(LE)!0.5!(PS)$) to reach the desired position

I used this command, both to position the node (FI) and to trace the segment

enter image description here

\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{compat=1.8}
\usetikzlibrary{positioning,calc}
\begin{document}


\begin{figure}[h]
\label{illustration}
\centering
\caption{The model}
\begin{tikzpicture}[
node distance=1cm and 1cm,
ar/.style={->,>=latex},
mynode/.style={
draw,
text width=4cm,
minimum height=1cm,
 align=center
 }
]
\node[mynode] (LE) {Level of expertise};
\node[mynode,right=of LE] (PS) {Problem solving time};

\node[mynode,below=of $(LE)!0.5!(PS)$] (FI) {Fluid intelligence};  % <-- changed


\draw[ar]
  (LE) -> node[above] {-}  (PS);
  \draw[ar]
  (FI) -> node[left] {-} ($(LE)!0.5!(PS)$); % <-- changed
\end{tikzpicture}
\end{figure}
\end{document}
0

enter image description here

\documentclass{article}
\usepackage{caption}        % <-- added
\usepackage{tikz}   
\usetikzlibrary{positioning}

\begin{document}
    \begin{figure}[h]
    \centering
\caption{The model}
    \label{illustration}    % <-- changed position to after caption
\begin{tikzpicture}[
node distance = 1cm and 2cm,% <-- changed
    ar/.style = {-latex},
mynode/.style = {draw,
                text width=4cm,
                minimum height=1cm,
                align=center}
                    ]
\node[mynode] (LE) {Level of expertise};
\node[mynode,right=of LE] (PS) {Problem solving time};
\node[mynode,below=of LE.south east] (FI) {Fluid intelligence};
%
\draw[ar]   (LE) -- coordinate[label=$-$] (a)  (PS);    % <-- changed
\draw[ar]   (FI) -- node[left] {$-$}  (a);              % <-- changed
\end{tikzpicture}
    \end{figure}
\end{document}

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.