如何让轴相同呢?

如何让轴相同呢?

在此处输入图片描述

我怎样才能重现上面的图片?

以下是我目前所掌握的信息:

\begin{tikzpicture}
    \begin{axis}[xticklabel style={anchor=east,rotate=90},
    date coordinates in=x,
    xticklabel={\day.\month.\year},
    table/col sep = semicolon,
    height = 0.3\paperheight, 
    width = 0.5\paperwidth,
    xmin=2015-10-01,
    xmax=2015-12-31,
    ymin=30,
    ymax=55,
    /pgf/number format/1000 sep={},
    no markers,
    every axis plot/.append style={ultra thick}
]
        \addplot table[x index=0, y index=2, col sep=comma] {oil_prices.csv};
        \addlegendentry{Нефть Brent}
        \addplot table[x index=0, y index=1, col sep=comma] {oil_prices.csv};
        \addlegendentry{Нефть WTI}  
    \end{axis}
\end{tikzpicture}

但它会产生下面的图片,其中 x 刻度是错误的。

在此处输入图片描述

答案1

\begin{tikzpicture}
\begin{axis}[xticklabel style={anchor=east,rotate=90},
 date coordinates in=x,
 xticklabel={\day.\month.\year},
 table/col sep = semicolon,

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%INCLUDED LINES
 xtick=data,
 symbolic x coords={{01.10.2015}, {15.10.2015}, {01.11.2015}, {15.11.2015}, {01.12.2015}, {15.12.2015},  {31.12.2015}},
 extra x ticks={{01.10.2015}, {15.10.2015}, {01.11.2015}, {15.11.2015}, {01.12.2015}, {15.12.2015},  {31.12.2015}},
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 height = 0.3\paperheight, 
 width = 0.5\paperwidth,
 xmin=2015-10-01,
 xmax=2015-12-31,
 ymin=30,
 ymax=55,
 /pgf/number format/1000 sep={},
 no markers,
 every axis plot/.append style={ultra thick}
 ]
 \addplot table[x index=0, y index=2, col sep=comma] {oil_prices.csv};
 \addlegendentry{Нефть Brent}
 \addplot table[x index=0, y index=1, col sep=comma] {oil_prices.csv};
 \addlegendentry{Нефть WTI}  
 \end{axis}
 \end{tikzpicture}

相关内容