TikZ:包围图形的阴影区域
TikZ: shaded area enveloping a graph
我需要绘制一个包围图形的阴影区域,如下例所示。我正在寻找自动化程序和更令人满意的结果。与示例相比,我需要更平滑的边缘和更规则的顶点(圆)和区域边界之间的距离。
在 TikZ 中绘制任意形状非常耗时,我怀疑一个聪明的技巧可能会完成这项工作,比如创建以每个顶点为中心的大重叠区域。有什么建议吗?
这里是一个最小的工作 LaTeX 代码,用于生成必须被包围的图形:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\tikzstyle{vertex}=[circle,draw=black,thick]
\begin{tikzpicture}
\foreach \pos/\name in {{(0,1)/1}, {(1,1)/2}, {(0,0)/3}, {(1,0)/4}, {(2,0)/5}, {(1,-.7)/6}}
\node[vertex] (\name) at \pos {};
\foreach \one/\two in {{1/2}, {1/3}, {1/4}, {1/6}, {2/3}, {2/4}, {2/5}, {3/6}, {4/6}, {4/5}}
\draw[thick] (\one) -- (\two);
\end{tikzpicture}
\end{document}
您可以将您的节点与带有刻度线的多边形连接起来:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\tikzset{vertex/.style={circle,draw=black,thick}}
\begin{tikzpicture}
\foreach \pos/\name in {{(0,1)/1}, {(1,1)/2}, {(0,0)/3}, {(1,0)/4}, {(2,0)/5}, {(1,-.7)/6}}
\node[vertex] (\name) at \pos {};
\foreach \one/\two in {{1/2}, {1/3}, {1/4}, {1/6}, {2/3}, {2/4}, {2/5}, {3/6}, {4/6}, {4/5}}
\draw[thick] (\one) -- (\two);
\begin{scope}[on background layer]
\filldraw[lightgray,line width=20pt,rounded corners=5pt] (1.center) -- (2.center) -- (5.center) -- (4.center) -- (6.center) -- (3.center) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
我需要绘制一个包围图形的阴影区域,如下例所示。我正在寻找自动化程序和更令人满意的结果。与示例相比,我需要更平滑的边缘和更规则的顶点(圆)和区域边界之间的距离。
在 TikZ 中绘制任意形状非常耗时,我怀疑一个聪明的技巧可能会完成这项工作,比如创建以每个顶点为中心的大重叠区域。有什么建议吗?
这里是一个最小的工作 LaTeX 代码,用于生成必须被包围的图形:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\tikzstyle{vertex}=[circle,draw=black,thick]
\begin{tikzpicture}
\foreach \pos/\name in {{(0,1)/1}, {(1,1)/2}, {(0,0)/3}, {(1,0)/4}, {(2,0)/5}, {(1,-.7)/6}}
\node[vertex] (\name) at \pos {};
\foreach \one/\two in {{1/2}, {1/3}, {1/4}, {1/6}, {2/3}, {2/4}, {2/5}, {3/6}, {4/6}, {4/5}}
\draw[thick] (\one) -- (\two);
\end{tikzpicture}
\end{document}
您可以将您的节点与带有刻度线的多边形连接起来:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\tikzset{vertex/.style={circle,draw=black,thick}}
\begin{tikzpicture}
\foreach \pos/\name in {{(0,1)/1}, {(1,1)/2}, {(0,0)/3}, {(1,0)/4}, {(2,0)/5}, {(1,-.7)/6}}
\node[vertex] (\name) at \pos {};
\foreach \one/\two in {{1/2}, {1/3}, {1/4}, {1/6}, {2/3}, {2/4}, {2/5}, {3/6}, {4/6}, {4/5}}
\draw[thick] (\one) -- (\two);
\begin{scope}[on background layer]
\filldraw[lightgray,line width=20pt,rounded corners=5pt] (1.center) -- (2.center) -- (5.center) -- (4.center) -- (6.center) -- (3.center) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}