我正在尝试使用 tikz 在 LaTex 中绘制下图,但我无法做到(说实话,我离它还很远……)。这是我需要的图形:
这是我目前得到的(我知道,它与期望的输出相差甚远):
这是我用来进行尝试的 MWE。
\documentstyle{standalone}
\usepackage{tikz}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw (0,0) node[anchor=east]{$(0,1,0)$} -- (4,0) node[anchor=west]{$(1,0,0)$} -- (2,4) node[anchor=south]{$(0,0,1)$} -- cycle;
\end{tikzpicture}
\end{figure}
\end{document}
有人能帮我得到我需要的数字吗?
谢谢你们!
答案1
作为起点,请尝试以下代码。图的其余部分是线条上的文本。将其与 放在一起\node
。
\documentclass[margin=2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,backgrounds,patterns}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (10,0);
\draw (A)node[below]{$(0,0,1)$} -- (B)node[below]{$(1,0,0)$} --++ (120:10)coordinate(C)node[above]{$(0,1,0)$} -- cycle;
\fill (A) circle (2pt);\fill (B) circle (2pt);\fill (C) circle (2pt);
\draw [name path=parallel](0,2.5)coordinate(Ap)--(10,2.5)coordinate(Bp);
\draw[name path=B--C] ($(B)!0.05!(C)!50mm!90:(C)$)coordinate(X1) -- ($(B)!0.95!(C)!50mm!90:(C)$)coordinate(X2);
\draw[name path=C--A] ($(C)!0.05!(A)!50mm!90:(A)$)coordinate(X3) -- ($(C)!0.95!(A)!50mm!90:(A)$)coordinate(X4);
\path [name intersections={of=parallel and B--C,by=E}];
\path [name intersections={of=parallel and C--A,by=F}];
\node [fill=red,circle,inner sep=1.5pt] at (E) {};
\node [fill=red,circle,inner sep=1.5pt] at (F) {};
\draw [name path=A--B] (A)--(B);
\path [name intersections={of=B--C and A--B,by=G}];
\node [fill=red,circle,inner sep=1.5pt] at (G) {};
\path [name intersections={of=C--A and A--B,by=H}];
\node [fill=red,circle,inner sep=1.5pt] at (H) {};
\path[pattern=vertical lines,pattern color=black] (E)--(F)--(H)--(G)--cycle;
\node [fill=white] at (5,2.2) {$C(v)$};
\foreach \i in {0.97,0.94,0.91}{
\draw[-latex] ( $ (Ap)!\i!(Bp) $ ) --++ (-90:0.75);}
\foreach \i in {0.03,0.06,0.09}{
\draw[-latex] ( $ (X1)!\i!(X2) $ ) --++ (30:0.75);}
\foreach \i in {0.03,0.06,0.09}{
\draw[-latex] ( $ (X3)!\i!(X4) $ ) --++ (150:0.75);}
\end{tikzpicture}
\end{document}