我必须使用 在我的 latex 文档中制作条形图\begin{tikzpicture}
。我需要为该图添加标题和标签。因此,我需要添加\begin{figure}
。但是,这会使图从文档中消失。当我删除\begin{figure}
和 时\end{figure}
,图会出现,但我无法添加标题。任何帮助都将不胜感激。谢谢。
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{url}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{balance}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
title={},
xlabel={Threshold},
xtick={3,4,5,6,7,8,9,10},
xmin=2, xmax=11,
ymin=10, ymax=110,
ymajorgrids=true,
legend style={at={(0.97,0.03)},anchor=south east}
]
\addplot[-, color=blue, smooth]
coordinates{
(3,100)(4,84.52)(5,84.76)(6,82.91)(7,83.24)(8,83.19)(9,82.64)(10,81.99)
};
\addlegendentry{Precision}
\addplot[-, color=green, smooth]
coordinates{
(3,11.48)(4,69.84)(5,74.75)(6,85.90)(7,94.43)(8,97.38)(9,98.36)(10,100)
};
\addlegendentry{Recall}
\addplot[dashed, color=red, smooth]
coordinates{
(3,20.59)(4,76.48)(5,79.44)(6,84.38)(7,88.48)(8,89.73)(9,89.82)(10,90.1)
};
\addlegendentry{$F_1$}
\end{axis}
\end{tikzpicture}
\caption{Accuracy performance with threshold}
\label{fig:threshold}
\end{figure}
\balance
\end{document}
答案1
消除\balance
。
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{url}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{balance}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[
title={},
xlabel={Threshold},
xtick={3,4,5,6,7,8,9,10},
xmin=2, xmax=11,
ymin=10, ymax=110,
ymajorgrids=true,
legend style={at={(0.97,0.03)},anchor=south east}
]
\addplot[-, color=blue, smooth]
coordinates{
(3,100)(4,84.52)(5,84.76)(6,82.91)(7,83.24)(8,83.19)(9,82.64)(10,81.99)
};
\addlegendentry{Precision}
\addplot[-, color=green, smooth]
coordinates{
(3,11.48)(4,69.84)(5,74.75)(6,85.90)(7,94.43)(8,97.38)(9,98.36)(10,100)
};
\addlegendentry{Recall}
\addplot[dashed, color=red, smooth]
coordinates{
(3,20.59)(4,76.48)(5,79.44)(6,84.38)(7,88.48)(8,89.73)(9,89.82)(10,90.1)
};
\addlegendentry{$F_1$}
\end{axis}
\end{tikzpicture}
\caption{Accuracy performance with threshold}
\label{fig:threshold}
\end{figure}
%\balance
\end{document}
\balance
或者在和之间添加一些文字figure
:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{url}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{balance}
\usepackage{booktabs}
\usepackage{pgfplots}
\usepackage{subfig}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{caption}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\begin{axis}[
title={},
xlabel={Threshold},
xtick={3,4,5,6,7,8,9,10},
xmin=2, xmax=11,
ymin=10, ymax=110,
ymajorgrids=true,
legend style={at={(0.97,0.03)},anchor=south east}
]
\addplot[-, color=blue, smooth]
coordinates{
(3,100)(4,84.52)(5,84.76)(6,82.91)(7,83.24)(8,83.19)(9,82.64)(10,81.99)
};
\addlegendentry{Precision}
\addplot[-, color=green, smooth]
coordinates{
(3,11.48)(4,69.84)(5,74.75)(6,85.90)(7,94.43)(8,97.38)(9,98.36)(10,100)
};
\addlegendentry{Recall}
\addplot[dashed, color=red, smooth]
coordinates{
(3,20.59)(4,76.48)(5,79.44)(6,84.38)(7,88.48)(8,89.73)(9,89.82)(10,90.1)
};
\addlegendentry{$F_1$}
\end{axis}
\end{tikzpicture}
\caption{Accuracy performance with threshold}
\label{fig:threshold}
\end{figure}
This is some text
\balance
\end{document}