我在 SE 中寻找过类似的问题,但没找到。这真是让我抓狂 :|
以下是 MWE:
\documentclass[xcolor=dvipsnames, 10pt, pdflatex]{beamer}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{animate}
\usepackage{multirow}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\mode<presentation>{
\usetheme{Warsaw} % Madrid, CambridgeUS, default, Pittsburgh
\useinnertheme{rounded} % rectangles
}
%\usepackage{beamerthemesplit}
\setbeamertemplate{navigation symbols}{}
%\usepackage{multicol}
%%%%%%%%%
\begin{document}
\section{Graphs}
\begin{frame}
\begin{tikzpicture}
\begin{axis}[
ybar,
axis x line=bottom,
axis y line=left,
xmax=12,
style={font=\footnotesize},
symbolic x coords ={1, 2, 4, 6, 12},
legend entries={A, B},
legend style={draw=none,at={(1.38, 0.5)}, anchor=east, font=\scriptsize},
legend columns=1]
\addplot table [x=X,y=A1] {TableGraphs.dat};
\addplot table [x=X,y=B1] {TableGraphs.dat};
\end{axis}
\end{tikzpicture}
\end{frame}
\begin{frame}
\begin{tabular}{c}
\begin{tikzpicture}
\begin{axis}[ scale only axis, height=0.25\textheight, width=0.65\linewidth, max space between ticks=40,
ybar,
style={font=\footnotesize},
xmax=12,
axis x line=bottom,
axis y line=left,
symbolic x coords ={1, 2, 4, 6, 12},
legend entries={A2, A3},
legend style={at={(1.38,0.5)},anchor= east, draw=none,font=\scriptsize},
legend columns=1,
unbounded coords=jump]
\addplot table [x=X,y=A2] {TableGraphs.dat};
\addplot table [x=X,y=A3] {TableGraphs.dat};
\end{axis}
\end{tikzpicture} \\
\begin{tikzpicture}
\begin{axis}[scale only axis, height=0.3\textheight, width=0.65\linewidth, max space between ticks=40,
symbolic x coords ={1, 2, 4, 6, 12},
style={font=\footnotesize},
axis x line=bottom,
axis y line=left,
xmax=12,
legend entries={B2, B3},
legend style={at={(1.38,0.5)}, anchor=east, draw=none, font=\scriptsize},
legend columns=1]
\addplot table [x=X,y=B2, unbounded coords=jump] {TableGraphs.dat};
\addplot table [x=X,y=B3, unbounded coords=jump] {TableGraphs.dat};
\end{axis}
\end{tikzpicture}
\end{tabular}
\end{frame}
\begin{frame}
\begin{tabular}{c}
\begin{tikzpicture}
\begin{axis}[scale only axis, height=0.25\textheight, width=0.65\linewidth, max space between ticks=40,
ybar,
font=\footnotesize,
axis x line=bottom,
axis y line=left,
symbolic x coords ={1, 2, 4, 6, 12},
legend entries={A4, A5},
legend style={at={(1.48,0.5)},anchor= east, draw=none, font=\scriptsize},
legend columns=1]
\addplot table [x=X,y=A4, unbounded coords=jump] {TableGraphs.dat};
\addplot table [x=X,y=A5,unbounded coords=jump] {TableGraphs.dat};
\end{axis}
\end{tikzpicture} \\
\begin{tikzpicture}
\begin{axis}[scale only axis, height=0.25\textheight, width=0.65\linewidth, max space between ticks=40,
symbolic x coords ={1, 2, 4, 6, 12},
font=\footnotesize,
axis x line=bottom,
axis y line=left,
unbounded coords=jump,
legend entries={B4, B5},
legend style={at={(1.48,0.5)}, anchor=east, draw=none, font=\scriptsize},
legend columns=1]
\addplot table [x=X,y=B4,unbounded coords=jump] {TableGraphs.dat};
\addplot table [x=X,y=B5,unbounded coords=jump] {TableGraphs.dat};
\end{axis}
\end{tikzpicture}
\end{tabular}
\end{frame}
\end{document}
以下是我使用的数据:
X A1 B1 A2 B2 A3 B3 A4 B4 A5 B5
1 6.8333333333 27.25 42.25 3.2991666667 69.4166666667 0.3233333333 37.25 0.7733333333 42.1666666667 0.19
2 14.3333333333 91.1666666667 90.5 3.1366666667 181 0.32 17.3333333333 0.6166666667 18.8333333333 0.165
4 24.3333333333 148.3333333333 160.6666666667 3.1933333333 303.6666666667 0.33 11.6666666667 0.8066666667 12 0.2233333333
6 56 349.5 387 3.405 900.5 0.335 5.5 0.96 4.5 0.245
12 125 1195 1301 3.5 nan nan nan nan nan nan
这是输出的第 2 页: 和第 3 页
问题出在第一张图片(输出的第二页)的条形图和第二张图片(输出的第三页)的条形图中。
缺少一个条形图。该表表示算法的运行时间和差距。对于较大的实例,在 x 轴的右侧,有缺失值。但两个条形图都只以 1 个红色条形图开始,而它们应该为每个 x 值有 2 个条形图,并且第一个图中的末尾只有一个蓝色条形图,而第二个图中的条形图应该停在 6 个,因为与 12 相关的两个值都缺失了。
以下是 Excel 中按相同顺序绘制的相同图表
我遗漏了什么吗?谢谢。