我正在尝试制作三元图,但默认轴与我需要完成的相反。以下是示例:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{ternary}
\pgfplotsset{width=9.5cm, height=9.5cm}
\begin{document}
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
xlabel= x,
ylabel= y,
zlabel= z,
xmin=0,
xmax=100,
ymin=0,
ymax=100,
zmin=0,
zmax=100,
clip=false,
disabledatascaling,
label style={sloped}
]
\end{ternaryaxis}
\end{tikzpicture}
\end{document}
我想要的结果看起来像这样(除了文本被反转):
我不知道这是否可能,而且手册也没有帮助。
答案1
输入xscale=-1
选项tikzpicture
。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{ternary}
\pgfplotsset{width=9.5cm, height=9.5cm}
\begin{document}
\begin{tikzpicture}[xscale=-1] %%% <------------------
\begin{ternaryaxis}[
ternary limits relative=false,
xlabel= x,
ylabel= y,
zlabel= z,
xmin=0,
xmax=100,
ymin=0,
ymax=100,
zmin=0,
zmax=100,
clip=false,
disabledatascaling,
label style={sloped}
]
\end{ternaryaxis}
\end{tikzpicture}
\end{document}
不翻转标签:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\usepgfplotslibrary{ternary}
\pgfplotsset{width=9.5cm, height=9.5cm,}
\begin{document}
\begin{tikzpicture}%[xscale=-1,]
\begin{ternaryaxis}[xscale=-1,
ternary limits relative=false,
xlabel= x,
ylabel= y,
zlabel= z,
xmin=0,
xmax=100,
ymin=0,
ymax=100,
zmin=0,
zmax=100,
clip=false,
disabledatascaling,
y label style={rotate=-60,anchor=south,yshift=3ex},
y tick label style={anchor=west},
x label style = {rotate=60,anchor=south,yshift=3ex},
x tick label style={anchor=east},
]
\end{ternaryaxis}
\end{tikzpicture}
\end{document}