我有两个三元图,我使用 pgfplots 将它们并排放在同一页上。我如何垂直排列它们并给它们贴上标签?下面给出了我的一个示例:
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{ternary}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sn,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sb,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
%\node[fill=white,draw] at (0.5,{sqrt(3)/2}) {$Sn$};
%\node[fill=white,draw] at (0,0) {$Sb$};
%\node[fill=white,draw] at (1,0) {$Bi$};
%\legend{0.9, 0.8,0.7}
\end{ternaryaxis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sb,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sn,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
%\node[fill=white,draw] at (0.5,{sqrt(3)/2}) {$Sn$};
%\node[fill=white,draw] at (0,0) {$Sb$};
%\node[fill=white,draw] at (1,0) {$Bi$};
%\legend{0.9, 0.8,0.7}
\end{ternaryaxis}
\end{tikzpicture}
\end{document}
答案1
您可以创建一个子图数组
\documentclass{article}
\usepackage{pgfplots,subcaption}
\usepgfplotslibrary{ternary}
\pgfplotsset{compat=1.8}
\begin{document}
\begin{figure}%
\begin{subfigure}{\columnwidth}\centering
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sn,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sb,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
\end{ternaryaxis}
\end{tikzpicture}
\caption{First Image}
\label{fig:a:first}
\end{subfigure}
\begin{subfigure}{\columnwidth}\centering
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sb,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sn,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
%\node[fill=white,draw] at (0.5,{sqrt(3)/2}) {$Sn$};
%\node[fill=white,draw] at (0,0) {$Sb$};
%\node[fill=white,draw] at (1,0) {$Bi$};
%\legend{0.9, 0.8,0.7}
\end{ternaryaxis}
\end{tikzpicture}
\caption{Second Image}
\label{fig:a:second}
\end{subfigure}
\begin{subfigure}{\columnwidth}\centering
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sn,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sb,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
\end{ternaryaxis}
\end{tikzpicture}
\caption{Third Image}
\label{fig:a:third}
\end{subfigure}
\caption{Main caption}%
\label{fig:a}%
\end{figure}
\end{document}
答案2
我使用stackengine
包来堆叠图像。首先,我执行了\savestack
保存每个单独图像的操作。由于它不是命令\long
,因此我必须从您的定义中删除空白行。然后,我使用 `\stackunder 将标签 3pt(shortstacks 的默认值)放在图像下方。最后,将带标签的图像堆叠在一起,间隔 15pt。
请注意,如果标签长于图像的宽度,则可以将标签文本设置\parbox
为图像宽度的倍数。
\documentclass{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{ternary}
\usepackage{stackengine}[2013-09-11]
\pgfplotsset{compat=1.8}
\begin{document}
\savestack{\firstimage}{%
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sn,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sb,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
%\node[fill=white,draw] at (0.5,{sqrt(3)/2}) {$Sn$};
%\node[fill=white,draw] at (0,0) {$Sb$};
%\node[fill=white,draw] at (1,0) {$Bi$};
%\legend{0.9, 0.8,0.7}
\end{ternaryaxis}
\end{tikzpicture}%
}
\savestack{\secondimage}{%
\begin{tikzpicture}
\begin{ternaryaxis}[
ternary limits relative=false,
width=7.5cm,
height=7.5cm,
ymax=1.0,
no markers,
% clip=false,
% disabledatascaling,
minor tick num=1,
grid=both,
xlabel=Sb,
xlabel style={
at={(axis cs:1,0,0)},
anchor=south
},
ylabel=Sn,
ylabel style={
at={(axis cs:0,1,0)},
anchor=10
},
zlabel=Bi,
zlabel style={
at={(axis cs:0,0,1)},
anchor=north west
},
]
\addplot3 [black,dashed] coordinates {
(0.9047, 0.0953, 0.0000)
(0.9019, 0.0883, 0.0098)
(0.8993, 0.0806, 0.0201)
(0.8969, 0.0722, 0.0309)
(0.8950, 0.0630, 0.0420)
(0.8936, 0.0532, 0.0532)
(0.8929, 0.0428, 0.0643)
(0.8930, 0.0321, 0.0749)
(0.8938, 0.0212, 0.0850)
(0.8953, 0.0105, 0.0942)
(0.8975, 0.0000, 0.1025)
};
\addplot3 [black,dashed] coordinates {
(0.8209, 0.1791, 0.0000)
(0.8131, 0.1682, 0.0187)
(0.8054, 0.1557, 0.0389)
(0.7980, 0.1414, 0.0606)
(0.7913, 0.1252, 0.0835)
(0.7859, 0.1071, 0.1071)
(0.7823, 0.0871, 0.1306)
(0.7810, 0.0657, 0.1533)
(0.7822, 0.0436, 0.1742)
(0.7859, 0.0214, 0.1927)
(0.7917, 0.0000, 0.2083)
};
\addplot3 [black,dashed] coordinates {
(0.7439, 0.2561, 0.0000)
(0.7313, 0.2418, 0.0269)
(0.7186, 0.2251, 0.0563)
(0.7060, 0.2058, 0.0882)
(0.6942, 0.1835, 0.1223)
(0.6841, 0.1580, 0.1580)
(0.6767, 0.1293, 0.1940)
(0.6729, 0.0981, 0.2290)
(0.6734, 0.0653, 0.2613)
(0.6777, 0.0322, 0.2901)
(0.6848, 0.0000, 0.3152)
};
%\node[fill=white,draw] at (0.5,{sqrt(3)/2}) {$Sn$};
%\node[fill=white,draw] at (0,0) {$Sb$};
%\node[fill=white,draw] at (1,0) {$Bi$};
%\legend{0.9, 0.8,0.7}
\end{ternaryaxis}
\end{tikzpicture}%
}
\stackunder[15pt]{%
\stackunder{\firstimage}{Label for first image}%
}{%
\stackunder{\secondimage}{Label for second image}%
}
\end{document}