使用 PGFplots 和 txt 檔案在 LaTeX 中繪製多個時間序列圖 - 相對論問題

使用 PGFplots 和 txt 檔案在 LaTeX 中繪製多個時間序列圖 - 相對論問題

我在 Latex 中的單一圖表中繪製多個時間序列圖時遇到問題。

背景:

我有三種產品 - 馬鈴薯、蘋果和橘子。每個產品的歷史價格和預計價格均使用來自單獨 *.txt(製表符界定)檔案的資料繪製。數據如下

實際情況:

Date       ptts appls   orngs
2013-06-30  10  20  30
2013-07-30  11  21  31
2013-08-30  12  22  32
2013-09-30  13  23  33
2013-10-30  14  24  34
2013-11-30  15  25  35
2013-12-30  16  26  36
2014-01-30  17  27  37

Forecast
2014-02-28  18  28  38
2014-03-28  19  29  39
2014-04-28  20  30  40
2014-05-28  21  31  41
2014-06-28  22  32  42
2014-07-28  23  33  43

為了實現預測和歷史資料之間的連續性,最後的歷史資料作為第一個預測點包含在txt檔案中(上面未顯示)。

我用來繪製此圖的程式碼是:

\begin{center}
\begin{tikzpicture}[line join=round]
\begin{axis}[width=18cm, height=300pt,xticklabel=\month.\year,date coordinates in=x,
xticklabel style= {rotate=45,anchor=north east},
stack plots=y,title=Product Price Forecast,]
\addplot table {appl-A.txt};
\addplot table{ptts-A.txt};
\addplot table {orngs-A.txt};
 \addplot table {appl-F.txt};
 \addplot table{ptts-F.txt};
\addplot table {orngs-F.txt};
 \end{axis}
 \end{tikzpicture}
 \end{center}

我得到的情節是完全錯誤的。看起來其中一個產品設定了繪製所有圖的相對基礎。任何人都知道 PFGplots 包中是否存在某種絕對與相對切換?請參考下圖。

陰謀

答案1

來自評論的CW:

stack plots選項導致了這種堆疊行為。刪除它以恢復預設的繪圖行為。

相關內容