
Soy nuevo en tikzp y necesito ayuda para realizar esta tarea (representando a un moderador). ¿Alguien podría ayudarme con mi código? ¿Cómo puedo extender la longitud de la flecha? ¿Y cómo decirle a tikzp que debería dibujar este tipo de flecha?
Mi código:
\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}
Respuesta1
Otra respuesta más, definiendo a coordinate
sobre la marcha al dibujar la flecha de LE
a 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}
Respuesta2
utilizar calc
la biblioteca y ($(LE)!0.5!(PS)$)
llegar a la posición deseada
Utilicé este comando, tanto para posicionar el nodo (FI) como para trazar el segmento.
\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}
Respuesta3
\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}