![强制刻度与三元图中的轴垂直](https://linux22.com/image/341188/%E5%BC%BA%E5%88%B6%E5%88%BB%E5%BA%A6%E4%B8%8E%E4%B8%89%E5%85%83%E5%9B%BE%E4%B8%AD%E7%9A%84%E8%BD%B4%E5%9E%82%E7%9B%B4.png)
我知道对于大多数人来说,三元图中的刻度是可以的,但我需要它们垂直于轴。三元图中的轴是倾斜的,我希望它们与轴成 90 度。看看我拙劣的艺术作品:
劣质艺术 v2:
我的 MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{xcolor}
\definecolor{verdeclaro}{RGB}{178,223,138}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{ternary}
\begin{document}
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
xlabel= Solid,
xlabel style={at={(axis cs:1,0,0)},anchor=south},
ylabel= Liquid,
ylabel style={at={(axis cs:0,1,0)},anchor=north east},
zlabel= Gas,
zlabel style={at={(axis cs:0,0,1)},anchor=north west},
minor tick num=1,
xtick align=inside,
ytick align=inside,
ztick align=inside,
grid=none,
xticklabels={,,},
yticklabels={,,},
zticklabels={,,},
area style,
axis line style={thick},
clip=false,
disabledatascaling,
]
\addplot3[fill=verdeclaro, dashed,thin] table {
0.6 0 0.4
0 1 0.4
0 0 1
};
\end{ternaryaxis}
\end{tikzpicture}
\end{document}
答案1
好的,如果这是一个说明图,它实际上不需要三元图。你可以直接使用tikz
:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,intersections,through,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[thick,decoration={ticks, pre length=2.5mm, segment length=5mm, post length=2.5mm, amplitude=2pt}]
\def\A{Liquid} \def\B{Gas}
\def\C{Solid}
\coordinate [label=left:\A] (A) at (0,0);
\coordinate [label=right:\B] (B) at (50mm,0);
\node [name path=D] at (A) [circle through=(B)] {};
\node [name path=E] at (B) [circle through=(A)] {};
\path [name intersections={of=D and E,by={[label=above:\C]C}}];
\draw (A) -- (C) -- (B) -- cycle;
\draw[decorate] (A) -- (C);
\draw[decorate] (C) -- (B);
\draw[decorate] (B) -- (A);
\end{tikzpicture}
\end{document}
不幸的是,您必须计算segment lenght
参数才能使刻度正确定位(我确信有一种自动化的方法可以做到这一点,但我懒了):
segment length = (veclength( (A)-(B) ) - (pre length+post length) )/ (number of ticks-1)
在这种情况下(50-5)/9=5