
Tengo el siguiente MWE, que me gustaría utilizar como una especie de hoja de ruta para la presentación de la defensa. Básicamente todo funciona y se ve bien, pero hay dos cosas que no sé cómo solucionar. Lo primero es cómo hacer que los nodos aparezcan exactamente uno encima del otro, de modo que, por ejemplo, el punto de partida a la derecha de la Disertación sea el mismo para los tres caminos que parten desde allí. El segundo problema es cómo hacer que el círculo dentro de cada nodo tenga la misma opacidad que la línea y el relleno.
\documentclass{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{pgfplots}
\usetikzlibrary{ arrows
, positioning
, calc
, arrows.meta
, shapes
, snakes}
\colorlet{Navyblue}{NavyBlue}
\tikzstyle{project} = [
align=left
%, fill=NavyBlue
, opacity=0.2
, text opacity=1]
\newcommand{\myopacity}{1}
\begin{document}
\begin{tikzpicture}[baseline=(current bounding box.center), font=\sffamily, node distance=2cm]
\draw
node[project,anchor=east](P) {\textbf{Dissertation}}
node[project
,right= 2in of P.east
, anchor=east
, text opacity=0.4](P23) {}
node[project
, above= of P23.west
, anchor = west
](P1) {\textbf{Project I:}}
node[project
, right = 1in of P23
, text opacity=0.4](P2) {Project II: }
node[project
, below= 0.5in of P2.west
, anchor=west
, text opacity=0.4](P3) {Project III: }
node[project
, below= of P23.west
, anchor=west
, text opacity=0.4](P4) {Project IV:};
% Define different colors
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = 0.4] (P.east) -- (P23.west);
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, darkgray
, opacity = 0.4] (P23.east) -- (P2.west);
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, darkgray
, opacity = 0.4
] (P23.east) -- (P3.west);
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = \myopacity] (P.east) -- (P1.west);
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, RoyalBlue
, opacity = 0.4] (P.east) -- (P4.west);
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = \myopacity] (P.east) -- (P1.west);
\end{tikzpicture}
\end{document}
Este es el resultado de los cambios propuestos en el primer comentario:
Respuesta1
En lugar de colocar los textos en los nodos:node[project,anchor=east](P) {\textbf{Dissertation}}
Los coloco a modo de etiqueta. Las etiquetas son nodos, tienen las mismas opciones que los nodos y se pueden modificar de la misma forma:node[project,anchor=east,label={left:\textbf{Dissertation}}](P) {}
Esto te permitirá dibujar nodos circulares:
\tikzset{project/.style={ align=left
%, fill=NavyBlue
, opacity=0.2
, text opacity=1
,draw %draw a circle node
,circle}
}
Esto simplifica el código de dibujo lineal entre nodos. Estos últimos conectan nodos vacíos y no es necesario especificar la P.east
posición P23.west
ni dibujar sus extremos en un círculo como:{Circle[length=8pt]}-{Circle[length=8pt]}
\draw[{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = 0.4] (P.east) -- (P23.west);
El código se convierte en:
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = 0.4] (P) edge (P23);
Comenté todas las líneas de código que se volvieron inútiles sin eliminarlas.
Creé un nuevo nodo (P23')
:
node[project
,right= 2in of P
%, anchor=east
, text opacity=0.4](P23) {}
node[project
,right= 10pt of P23
%, anchor=east
, text opacity=0.4](P23') {}
\documentclass{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{pgfplots}
\usetikzlibrary{ %arrows
, positioning
, calc
, arrows.meta
, shapes
, snakes}
\colorlet{Navyblue}{NavyBlue}
\tikzset{project/.style={
align=left
%, fill=NavyBlue
, opacity=0.2
, text opacity=1
,draw
,circle}}
\newcommand{\myopacity}{1}
\begin{document}
\begin{tikzpicture}[%baseline=(current bounding box.center),
font=\sffamily,
node distance=2cm]
\draw
node[project,anchor=east,label={left:\textbf{Dissertation}}](P) {}
node[project
,right= 2in of P
%, anchor=east
, text opacity=0.4](P23) {}
node[project
,right= 10pt of P23
%, anchor=east
, text opacity=0.4](P23') {}
node[project
, above= of P23
%, anchor = west
, label= right:\textbf{Project I:}
](P1) {}
node[project
, right = 1in of P23
, text opacity=0.4
,label=right:Project II: ](P2) {}
node[project
, below= 0.5in of P2
% , anchor=west
, text opacity=0.4,label=right:Project III: ](P3) {}
node[project
, below= of P23
%, anchor=west
, text opacity=0.4
,label=below:Project IV:](P4) {};
% Define different colors
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = 0.4] (P) edge (P23);
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, darkgray
, opacity = 0.4] (P23') -- (P2);
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, darkgray
, opacity = 0.4
] (P23') -- (P3);
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = \myopacity] (P) -- (P1);
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, RoyalBlue
, opacity = 0.4] (P) -- (P4);
\draw[%{Circle[length=8pt]}-{Circle[length=8pt]}
, line width=2pt
, Gray
, opacity = \myopacity] (P) -- (P1);
\end{tikzpicture}
\end{document}