1

I have a problem with plotting multiple time series plots in a single graph in Latex.

Background:

I have three products - Potatoes, Apples, and Oranges. Each products' historical price and projected price is plotted using data from a separate *.txt (tab delineated) file. The data is as follows

Actuals:

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

In order to achieve continuity between the forecast and the historical data, the last historical data is included as the first forecast point in the txt file (not shown above).

The code that I use to graph this is:

\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}

The plot that I get is completely wrong. It looks like one of the products sets a relative basis at which all the plots are plotted. Is there some kind of an Absolute vs Relative toggle in the PFGplots package that anybody is aware of? Please see plot below.

plot

  • 3
    Remove the stack plots line. – Jake Mar 24 '14 at 6:07
1

CW from the comments:

The stack plots option is causing this stacking behavior. Remove that to revert to the default plotting behavior.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.