未绘制线

未绘制线

最低限度-不起作用-例如:

\documentclass[letterpaper]{article}
\usepackage{pgfplots,tikz}
\usepgfplotslibrary{dateplot}
\usepackage[margin=0.5in]{geometry}

\pgfplotsset{compat=1.11}

\begin{document}
\vspace*{3cm}
\begin{tikzpicture}
\begin{axis}[
xmin=2015-12-21 00:00:00,
xmax=2016-01-22 00:00:00,
hide y axis,
ymin= 0,
ymax = 1,
y = 1cm,
axis x line*=bottom,
date coordinates in=x,
date ZERO=2015-12-21 00:00:00,
width=6.5in,
xlabel style = {yshift=4mm,anchor=east},
x tick label style={
        rotate=45,yshift=-0.1cm,
        anchor=east,font=\large\bfseries}
]
\addplot [line width=6pt] table[col sep=comma] {
2015-12-21 06:31:00, 0.5
2016-01-13 08:41:00, 0.5
};
\end{axis}
\end{tikzpicture}
\end{document} 

答案1

您必须包括header=false表输入的配置,因为这是最初的true,请参阅第 50 页最新pgfplots手册(v1.13)。如果不包含此项,则表格的第一行将用作列名。

因此下面的操作应该可行:

\documentclass[letterpaper]{article}
\usepackage{pgfplots,tikz}
\usepgfplotslibrary{dateplot}
\usepackage[margin=0.5in]{geometry}

\pgfplotsset{compat=1.11}

\begin{document}
\vspace*{3cm}
\begin{tikzpicture}
\begin{axis}[
xmin=2015-12-21 00:00:00,
xmax=2016-01-22 00:00:00,
hide y axis,
ymin= 0,
ymax = 1,
y = 1cm,
axis x line*=bottom,
date coordinates in=x,
date ZERO=2015-12-21 00:00:00,
width=6.5in,
xlabel style = {yshift=4mm,anchor=east},
x tick label style={
        rotate=45,yshift=-0.1cm,
        anchor=east,font=\large\bfseries}
]
\addplot [line width=6pt] table[col sep=comma,header=false] {
2015-12-21 06:31:00, 0.5
2016-01-13 08:41:00, 0.5
};
\end{axis}
\end{tikzpicture}
\end{document}

输出

相关内容