我有以下代码:
\documentclass[letterpaper]{article}
\usepackage[table]{xcolor}
\definecolor{asparagus}{rgb}{0.53, 0.66, 0.42}
\definecolor{bleudefrance}{rgb}{0.19, 0.55, 0.91}
\definecolor{orange}{rgb}{0.98, 0.6, 0.01}
\usepackage{tikz}
\usetikzlibrary{calc, intersections,bbox}
\begin{document}
\begin{center}
\begin{tikzpicture}
\draw[thick,red] (30:1) node[above right,black!80] {$3$} -- (210:2);
\draw[thick,orange!80] (150:1) node[above left,black!80] {$2$} -- (330:2);
\draw[thick,asparagus!80] (270:1) node[below right,black!80] {$5$} -- (90:2);
\draw (90:2) node[above right,black!80] {$1$} -- (210:2) node[below left,black!80] {$6$} -- (330:2) node[below right,black!80] {$7$} -- cycle;
\draw[thick,bleudefrance!80] (30:1cm) arc[start angle=30, end angle=270, radius=1cm];
\fill (0:0) node[above right,black!80] {$4$} circle(3pt)
(30:1) circle(3pt)
(90:2) circle(3pt)
(150:1) circle(3pt)
(210:2) circle(3pt)
(270:1) circle(3pt)
(330:2) circle(3pt);
\end{tikzpicture}
\end{center}
\end{document}
结果如下:
现在,我的问题是:如何将全黑的线条循环在每个部分涂上不同的颜色(例如,连接 6-2-1 的边应该是一种颜色,连接 6-5-7 的边应该有另一种颜色,最后,连接 1-3-7 的边也应该有不同的颜色)。在这种情况下,颜色是不相关的。
提前感谢任何帮助。
答案1
你可以试试:
\documentclass{standalone}
\usepackage[table]{xcolor}
\definecolor{asparagus} {rgb}{0.53, 0.66, 0.42}
\definecolor{bleudefrance}{rgb}{0.19, 0.55, 0.91}
\definecolor{orange} {rgb}{0.98, 0.6, 0.01}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[thick, red] ( 30:1) node[above right,black!80] {$3$} -- (210:2);
\draw[thick, orange!80] (150:1) node[above left, black!80] {$2$} -- (330:2);
\draw[thick, asparagus!80] (270:1) node[below right,black!80] {$5$} -- ( 90:2);
\draw (90:2) node[above right,black!80] {$1$}
-- (210:2) node[below left, black!80] {$6$}
-- (330:2) node[below right,black!80] {$7$} -- cycle;
\draw[thick, bleudefrance!80] (30:1) arc[start angle=30, end angle=270, radius=1];
\draw[thick, green] (330:2) -- (90:2); %<-- connects 1-3-7
\draw[thick, blue] (210:2) -- (90:2); %<-- connects 1-2-6
\draw[thick, magenta] (210:2) -- (330:2); %<-- connects 6-5-7
\fill[radius=3pt]
(0:0) node[above right,black!80] {$4$}
circle[]
(30:1) circle[]
(90:2) circle[]
(150:1) circle[]
(210:2) circle[]
(270:1) circle[]
(330:2) circle[];
\end{tikzpicture}
\end{document}