我有以下 MWE
\documentclass[11pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usetikzlibrary{calc,arrows,fadings,decorations.pathreplacing,decorations.markings,patterns,shapes.geometric}
\begin{document}
\begin{tikzpicture}
\path[fill] (-4,-1) edge[out = 0, in =160, thick] (-0.5,-1.6)
(0.25,1.2) edge[out = 20, in =180, thick] (3.75,1.8)
(-4,-1) edge [thick, out=15,in = 195](-2.5,-0.25)
(2.25,-3.05) edge[thick, out = -15, in = 165] (3.75,-3.80)
(-2.5,-0.25) edge[thick, out = -15 , in =250, looseness=1.6] (0.25,1.2)
(2.25,-3.05) edge[thick, out = 195, in = -70, looseness = 1.6] (-0.5,-1.6)
(3.75,1.8) edge[thick, out = 225, in = 75] (2,-0.25)
(2,-0.25) edge[thick, out =315, in = 105] (3.75,-2.05)
(3.75,-2.05) edge[thick, out=195,in=-15] (2,-2)
(2,-2) edge[thick, out =315,in=135 ] (3.75,-3.8)[draw];
\end{tikzpicture}
\end{document}
产生
我的问题是我想给图形上色,但我做不到。我试过使用\filldraw, shadedraw
,但无济于事。有没有巧妙的方法可以解决这个问题?
答案1
边会分解路径。您只能填充连续路径。因此请使用to
而不是 ,edge
并确保顺序正确。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[thick,fill=blue] (-4,-1) to[out=0,in=160] (-0.5,-1.6)
to[out=-70,in=195,looseness=1.6] (2.25,-3.05)
to[out=-15,in=165] (3.75,-3.80)
to[out=135,in=315] (2,-2)
to[out=-15,in=195] (3.75,-2.05)
to[out=105,in=315] (2,-0.25)
to[out=75,in=225] (3.75,1.8)
to[out=180,in=20] (0.25,1.2)
to[out=250,in=-15,looseness=1.6] (-2.5,-0.25)
to[out=195,in=15] cycle;
\end{tikzpicture}
\end{document}