我有以下代码,它生成一个正方形的边界,每个边都标有某种箭头。我想用颜色填充内部,但是当我添加“fill=color”作为参数时,生成的图像没有任何变化。我该如何让它工作?
\[
\begin{tikzcd}[
sep=2cm,
cells={shape=coordinate}
]
\ar[draw=none,r, "{\tikz\node[rotate=270,inner sep=0pt] {\tikz\draw[->](0,0);}; }" description]
\ar[dash,r]
&
{}
\\
\ar[draw=none,r, "{\tikz\node[rotate=270,inner sep=0pt] {\tikz\draw[->](0,0) ;}; }" description]
\ar[draw=none,u, "{\tikz\node[inner sep=0pt] {\tikz\draw[->>](0,0) ;}; }" description]
\ar[dash,r]
\ar[dash,u]
&
{}
\ar[draw=none,u, "{\tikz\node[inner sep=0pt] {\tikz\draw[->>](0,0) ;}; }" description]
\ar[dash,u]
\end{tikzcd}.
\]
答案1
这与填充一起工作并且不嵌套tikzpicture
。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[insert arrow/.style args={#1/#2}{postaction={decorate,
decoration={markings,mark=at position #1 with {\arrow{#2}}}}}]
\draw[fill=blue!30,insert arrow/.list={0.125/>,0.37/>,0.38/>,0.625/<,0.87/<,0.88/<}] (0,0) -| ++ (2,2) -| cycle;
\end{tikzpicture}
\end{document}