
Sou novo no tikzp e preciso de ajuda para realizar esta tarefa (representando um moderador). Alguém poderia me ajudar com meu código? Como posso estender o comprimento da flecha? E como dizer ao tikzp que ele deveria desenhar esse tipo de flecha?
Meu 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}
Responder1
Mais uma resposta, definindo a coordinate
instantaneamente ao desenhar a seta de LE
para 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}
Responder2
use calc
a biblioteca e ($(LE)!0.5!(PS)$)
alcance a posição desejada
Utilizei esse comando, tanto para posicionar o nó (FI) quanto para traçar o 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}
Responder3
\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}