@Qrrbrbirlbel,非常感谢您对此链接的回复:如何封闭顶点并为其着色?,如何让黄色圆圈看到它的标签?
我向您发送了我的乳胶代码:
%https://q.uiver.app/#q=WzAsNixbNCwxXSxbMywxLCJ2XzQiXSxbMywzLCJ2XzUiXSxbMCw0LCJ2XzMiXSxbMCwyLCJ2XzIiXSxbMCwwLCJ2XzEiXSxbNSwxLCIiLDAseyJjb2xvdXIiOlswLDYwLDYwXSwic3R5bGUiOnsiaGVhZCI6eyJuYW1lIjoibm9uZSJ9fX1dLFszLDEsIiIsMix7ImNvbG91ciI6WzAsNjAsNjBdLCJzdHlsZSI6eyJoZWFkIjp7Im5hbWUiOiJub25lIn19fV0sWzQsMiwiIiwwLHsiY29sb3VyIjpbMCw2MCw2MF0sInN0eWxlIjp7ImhlYWQiOnsibmFtZSI6Im5vbmUifX19XSxbNSwyLCIiLDIseyJjb2xvdXIiOlswLDYwLDYwXSwic3R5bGUiOnsiaGVhZCI6eyJuYW1lIjoibm9uZSJ9fX1dXQ==
\[\begin{tikzcd}[cramped]
|[blue] [draw=blue, circle]| {v_1} \\
&&& {v_4} & {} \\
|[blue] [draw=blue, circle]| {v_2} \\
&&& {v_5} \\
|[red] [fill, yellow] [draw=blue, circle]| {v_3}
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=1-1, to=2-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=5-1, to=2-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=3-1, to=4-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=1-1, to=4-4]
\end{tikzcd}\]
答案1
代码行
|[red] [fill, yellow] [draw=blue, circle]| {v_3}
是不对的。应该是
|[red] [circle, draw=blue, fill=yellow]| {v_3} % <---
完整的 MWE 是:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{cd, graphs.standard}
\definecolor{Red}{RGB}{214,92,92}
\begin{document}
\[
\begin{tikzcd}[cramped]
|[blue] [draw=blue, circle]| {v_1} \\
&&& {v_4} & {} \\
|[blue] [draw=blue, circle]| {v_2} \\
&&& {v_5} \\
|[red] [circle, draw=blue, fill=yellow]| {v_3} % <---
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=1-1, to=2-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=5-1, to=2-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=3-1, to=4-4]
\arrow[draw={rgb,255:red,214;green,92;blue,92}, no head, from=1-1, to=4-4]
\end{tikzcd}
\]
\end{document}
附录:
看看下面的更短的图表代码是否可以接受:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{cd, graphs.standard}
\definecolor{Red}{RGB}{214,92,92}
\begin{document}
\[
\begin{tikzcd}[cramped,
arrows= {Red, no head}
]
|[blue, draw=blue, circle]| {v_1} \\
&&& {v_4} & {} \\
|[blue, draw=blue, circle]| {v_2} \\
&&& {v_5} \\
|[red, circle, draw=blue, fill=yellow]| {v_3} % <---
\arrow[from=1-1, to=2-4]
\arrow[from=5-1, to=2-4]
\arrow[from=3-1, to=4-4]
\arrow[from=1-1, to=4-4]
\end{tikzcd}
\]
\end{document}
或者
%\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{cd, graphs.standard}
\definecolor{Red}{RGB}{214,92,92}
\begin{document}
\[
\begin{tikzcd}[cramped,
arrows= {Red, no head},
cells = {nodes={circle, draw=blue, text=blue}}
]
v_1 \\
&&& |[draw=none]| v_4 \\
v_2 \\
&&& |[draw=none]| v_5 \\
|[fill=yellow, text=red]| v_3
\arrow[from=1-1, to=2-4]
\arrow[from=5-1, to=2-4]
\arrow[from=3-1, to=4-4]
\arrow[from=1-1, to=4-4]
\end{tikzcd}
\]
\end{document}
结果和以前一样。