xtick=data
我正在使用和向绘图添加 x 个刻度标签xticklabels from table
。如何跳过每个第二个刻度标记?
我的代码如下。
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{tikzpicture}
\pgfplotstableread[col sep=comma]{./data/crash_1987_returns.csv}{\loadedtable};
\begin{axis}[
width=17cm,
height=7cm,
grid=both,
enlarge x limits=false,
no marks,
xtick=data,
xticklabels from table={\loadedtable}{Date},
x tick label style={rotate=90},
y tick label style={
/pgf/number format/fixed,
/pgf/number format/precision=5
},
scaled y ticks=false,
legend style={at={(0.025,0.95)},anchor=north west},
ylabel={Change (\%)},
y label style={at={(ticklabel* cs:1.01)}, anchor=south, rotate=-90}
]
\pgfplotsinvokeforeach{SP500, DIJA}{
\addplot+[ultra thick] table [x expr=\coordindex, y=#1] {\loadedtable};
\addlegendentry{S\&P 500};
\addlegendentry{DIJA};
}
\end{axis}
\end{tikzpicture}
\end{document}