我有以下一组图:
\documentclass{article}
\usepackage{fullpage}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=2 by 2,
xlabels at=edge bottom,
ylabels at=edge left,
horizontal sep=2cm,
vertical sep=3cm,
},
symbolic x coords={Hamming loss, Accuracy, F1-score, Score, Recall, Precision, Jaccard similarity, F-Beta score},
xtick=data,
x tick label style={rotate=45,anchor=east},
ymax=100,
ymin=10,
width=0.5\linewidth
]
\nextgroupplot
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\nextgroupplot
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
%Sistema para un kernel lineal:
\nextgroupplot
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\nextgroupplot[legend to name=testLegend]
%bolita
\addlegendentry{text1}
\addplot[mark=*,thick,blue] coordinates {(Hamming loss,55.36) (Accuracy,44.63) (F1-score,27.55) (Score,46.63) (Recall,44.63) (Precision, 19.26) (Jaccard similarity, 44.63) (F-Beta score,10.03)};
%rombo
\addlegendentry{text1 + text2}
\addplot[mark=diamond*,thick,red] coordinates{(Hamming loss,55.12) (Accuracy,44.87) (F1-score,27.80) (Score,46.65) (Recall,45.0) (Precision, 20.20) (Jaccard similarity, 44.87) (F-Beta score,10.00)};
%linea punteada
\addlegendentry{text1 + text2 + text3}
\addplot[mark=o,mark options={solid},black,thick,dashed] coordinates {(Hamming loss,54.89) (Accuracy, 45.10) (F1-score,28.04) (Score,46.14) (Recall,45.0) (Precision, 20.34) (Jaccard similarity, 45.10) (F-Beta score,10.20)};
\addlegendentry{text1 + text2 + text3 + text4}
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\end{groupplot}
\end{tikzpicture}
\ref{testLegend}
\end{center}
\end{document}
我想为每个情节添加一些字幕,例如这样的:
Title Title
-------------- ----------------
- - - -
- - - -
- - - -
- - - -
-------------- ----------------
Title Title
-------------- ----------------
- - - -
- - - -
- - - -
- - - -
-------------- ----------------
我尝试\caption{}
在每个图中添加一个,问题是当我添加一些标题时,它会弄乱所有的 tikz 图。例如,这些图相互重叠,有没有人知道如何解决这个问题?我猜这种情况可能是由浮动引起的。提前谢谢大家。
答案1
当我给组中的每个图添加一个标题时,如下所示:
\documentclass{article}
\usepackage{fullpage}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=2 by 2,
xlabels at=edge bottom,
ylabels at=edge left,
horizontal sep=2cm,
vertical sep=3cm,
},
symbolic x coords={Hamming loss, Accuracy, F1-score, Score, Recall, Precision, Jaccard similarity, F-Beta score},
xtick=data,
x tick label style={rotate=45,anchor=east},
ymax=100,
ymin=10,
width=0.5\linewidth
]
\nextgroupplot[title=Top Left]
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\nextgroupplot[title=Top Right]
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
%Sistema para un kernel lineal:
\nextgroupplot[title=Bottom Left]
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\nextgroupplot[title=Bottom Right,legend to name=testLegend]
%bolita
\addlegendentry{text1}
\addplot[mark=*,thick,blue] coordinates {(Hamming loss,55.36) (Accuracy,44.63) (F1-score,27.55) (Score,46.63) (Recall,44.63) (Precision, 19.26) (Jaccard similarity, 44.63) (F-Beta score,10.03)};
%rombo
\addlegendentry{text1 + text2}
\addplot[mark=diamond*,thick,red] coordinates{(Hamming loss,55.12) (Accuracy,44.87) (F1-score,27.80) (Score,46.65) (Recall,45.0) (Precision, 20.20) (Jaccard similarity, 44.87) (F-Beta score,10.00)};
%linea punteada
\addlegendentry{text1 + text2 + text3}
\addplot[mark=o,mark options={solid},black,thick,dashed] coordinates {(Hamming loss,54.89) (Accuracy, 45.10) (F1-score,28.04) (Score,46.14) (Recall,45.0) (Precision, 20.34) (Jaccard similarity, 45.10) (F-Beta score,10.20)};
\addlegendentry{text1 + text2 + text3 + text4}
\addplot[mark=diamond*,thick,yellow] coordinates{(Hamming loss,52.44) (Accuracy, 47.55) (F1-score,30.64) (Score,44.94) (Recall,47.55) (Precision, 22.61) (Jaccard similarity, 47.55) (F-Beta score,10.62)};
\end{groupplot}
\end{tikzpicture}
\ref{testLegend}
\end{center}
\end{document}
我明白了:
您得到不同的东西了吗/这不是您想要的吗?