4

I am trying to plot some data using pgfplots, but the data are so extensive that the maximum capacity is reached. I get the error: TeX capacity exceeded, sorry [main memory size=3000000].

What can I do to work around that problem? I am thinking of gnuplot, but I can't seem to get the syntax right. So, I wanted to plot the data, which is in a file, using gnuplot. I tried the following:

\addplot gnuplot [raw gnuplot,id=test,only marks]{plot 'date.dat' using 0:1};

In the pgfplot manual I could only find information about using gnuplot, when using functions, but not for cases when the data are already in an external file. I constructed a mwe down low, where you can see how I usualy plot my graphs. That works fine unless the datafile is a lot bigger than the one you'll see below.

Thanks a lot for your help.

\documentclass{scrbook}

\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{tikz}
\usepackage{filecontents}

\begin{filecontents}{date.dat}
2012-01-01  1   3
2012-01-02  2   4
2012-01-03  2   5
\end{filecontents}

\begin{document}

\begin{figure}
    \begin{tikzpicture}
        \begin{axis}
            [
            width=0.9\textwidth,
            height=0.3\textheight,
            date coordinates in=x,
            unbounded coords=jump,
            xtick={2012-01-01,2012-01-02,2012-01-03},
            clip=false,
            ]
            \addplot [only marks,mark size=1pt,red]table [x index=0,y index=1] {date.dat};
            \addplot [only marks,mark size=1pt,green]table [x index=0,y index=2] {date.dat};
        \end{axis}
    \end{tikzpicture}
\end{figure}

\end{document}
Stefan Pinnow
  • 29,535
  • 1
    One simple solution could be to compile with lualatex. – alfC Apr 18 '14 at 06:57
  • Take a look at http://tex.stackexchange.com/questions/71488/pgfplot-plotting-a-large-dataset/71504#71504. – Jake Apr 18 '14 at 08:53
  • 1
    Well, I cannot restrict the data as proposed in the link @Jake posted. I found the right syntax however for the gnuplot command which is \addplot [red]gnuplot [raw gnuplot] {plot 'date.dat' using 2:3;}; However, that doesn't solve my problem, because when I plot my original data (which includes about 15.000 observations) I still get the error: TeX capacity exceeded, sorry [main memory size=3000000]. Thank you alfC for your suggestion, but I don't want to compile with lualatex, because I haven't set it up yet, and I don't want to mess with what's currently working. – neptunhiker Apr 18 '14 at 09:58
  • How about this? – Pouya Apr 18 '14 at 10:15
  • I just read that post as well and I tried Thomas F. Sturm's answer by adding --extra-mem-bot=100000000 to my comp. options. That didn't help though. I still get the same error, only that my memory size is now higher since I "added" the extra memory. – neptunhiker Apr 18 '14 at 10:29
  • 15000 data points is an awful lot. Even on a very high res output device, you wouldn't be able to distinguish the individual dots, and you'd have a very large file that would take a long time to render. Are you sure you can't downsample the data in some fashion? – Jake Apr 18 '14 at 10:42
  • That's true, it's a really a lot. Basically I have 20 time series with about 700 observations. I would like to plot all of them into one graph using only dots. That way, I will get the whole picture of the pattern of my data. I could downsample the data, but that would be kind of random. I would really like to include all of them. – neptunhiker Apr 18 '14 at 11:11
  • As already mentioned above a solution could be to use lualatex, but that would take "forever" to compile. I thing the easiest solution would be to first have a look at the data in another program like matlab or whatever. If you then decide that it is really necessary to show all the data points you could export the data points only from e.g. matlab and then use \addplot graphics, which should not end up in the "TeX capacity exceeded" error. – Stefan Pinnow Feb 09 '18 at 21:49

0 Answers0