我需要你的幫助,如何在這張圖上在圖形的面的中心繪製名字,以及外面的面。非常感謝社區的幫助。我這裡有程式碼:
\begin{tikzpicture}
% Source : https://www.baeldung.com/cs/latex-drawing-graphs
% https://tex.stackexchange.com/questions/270543/draw-a-graph-in-latex-with-tikz
% https://tex.stackexchange.com/questions/315456/colouring-graphs-tikz
% source ellipse : https://www.overleaf.com/learn/latex/LaTeX_Graphics_using_TikZ%3A_A_Tutorial_for_Beginners_(Part_1)%E2%80%94Basic_Drawing
\draw [fill = green!5!white] (2,2) ellipse (7cm and 4cm);
%\draw [fill = green!5!white]
% (-1,-2) .. controls (0,-3) .. (5,-2) .. controls (9,1) and (7,7) .. (4,7.5) .. controls (0,8) and (-4,8) .. (-1,-2) ;
\path
( 0 , 3 ) coordinate (1)
( 2.5, 4 ) coordinate (2)
( 5 , 3 ) coordinate (3)
( 3.5, 1 ) coordinate (4)
( 1 , 0 ) coordinate (5);
\draw [fill = violet] (1) to [out=125,in=90,looseness=2] (3);
\draw [fill = yellow] (1) to [out=-120,in=-90,looseness=3] (4);
\draw (1) -- (3) ;
\draw [fill = orange] (2) -- (4) -- (5) -- (2);
\draw [fill = cyan] (2) -- (3) -- (4) -- (2);
\draw [fill = pink] (1) -- (2) -- (5) -- (1);
\draw (5) -- (1);
\draw (2) -- (4);
\draw (2) -- (5);
\tikzstyle{vertex} = [draw,circle,fill=white,inner sep = 3pt]
\node[vertex] [label = left: 1] at (1) {};
\node[vertex] [label = above : 2] at (2) {};
\node[vertex] [label = below: 3] at (3) {};
\node[vertex] [label = right: 4] at (4) {};
\node[vertex] [label = left: 5] at (5) {};
% \draw (0,0) arc (0:270:8mm);
% \draw (0,0) arc (0:315:1.75cm and 1cm);
\end{tikzpicture}
答案1
我的最終結果
\begin{tikzpicture}
% Source : https://www.baeldung.com/cs/latex-drawing-graphs
% https://tex.stackexchange.com/questions/270543/draw-a-graph-in-latex-with-tikz
% https://tex.stackexchange.com/questions/315456/colouring-graphs-tikz
% source ellipse : https://www.overleaf.com/learn/latex/LaTeX_Graphics_using_TikZ%3A_A_Tutorial_for_Beginners_(Part_1)%E2%80%94Basic_Drawing
\draw [fill = green!5!white] (2,2) ellipse (7cm and 4cm);
%\draw [fill = green!5!white]
% (-1,-2) .. controls (0,-3) .. (5,-2) .. controls (9,1) and (7,7) .. (4,7.5) .. controls (0,8) and (-4,8) .. (-1,-2) ;
\path
( 0 , 3 ) coordinate (1)
( 2.5, 4 ) coordinate (2)
( 5 , 3 ) coordinate (3)
( 3.5, 1 ) coordinate (4)
( 1 , 0 ) coordinate (5);
\draw [fill = violet] (1) to [out=125,in=90,looseness=2] (3);
\draw [fill = yellow] (1) to [out=-120,in=-90,looseness=3] (4);
\draw (1) -- (3) ;
\draw [fill = orange] (2) -- (4) -- (5) -- (2);
\draw [fill = cyan] (2) -- (3) -- (4) -- (2);
\draw [fill = pink] (1) -- (2) -- (5) -- (1);
\draw (5) -- (1);
\draw (2) -- (4);
\draw (2) -- (5);
\tikzstyle{vertex} = [draw,circle,fill=white,inner sep = 3pt]
\node[vertex] [label = left: 1] at (1) {};
\node[vertex] [label = above : 2] at (2) {};
\node[vertex] [label = below: 3] at (3) {};
\node[vertex] [label = right: 4] at (4) {};
\node[vertex] [label = left: 5] at (5) {};
% \draw (0,0) arc (0:270:8mm);
% \draw (0,0) arc (0:315:1.75cm and 1cm);
\path
(-2 , 3 ) coordinate () {} node[left] {face6}
(1.5, 4.5) coordinate () {} node[left] {face1}
(1.8, 2.5 ) coordinate () {} node[left] {face2}
(3, 1.5) coordinate () {} node[left] {face3}
(4.5, 2.5) coordinate () {} node[left] {face4}
(2.5, -0.7) coordinate () {} node[left] {face5}
;
\end{tikzpicture}
\\ \\ \\
\begin{tikzpicture}[c/.style={circle,draw,inner sep=2pt}]
\path[nodes={text=teal}]
(0,0) node[c] (v1) {} node[below left] {$v_1$}
(15,0) node[c] (v2) {} node[below right] {$v_2$}
(10,1) node[c] (v3) {} node[below] {$v_3$}
% (8,2) node[c] (v3) {} node[below] {$v_4$}
(7,8) node[c] (v16){} node[above] {$v_{16}$} ;
\draw (v1)--(v2)--(v3)--(v1);
\draw (v1) to[bend left=30] (v16) (v2) to[bend right] (v16) ;
\end{tikzpicture}