I have lots of data to be plotted(around 100000 points) in a single plot. But pgfplot is giving me error. What is the maximum limit(of points) for it to plot. But gnuplot is giving me the plot whereas pgfplot doesn't.

  • have you tried increasing the memory available to tex? also an example would help.
    – Mica
    Nov 16, 2010 at 2:09

4 Answers 4


100000 points is usually beyond the capabilities of pgfplots (unless with extreme memory settings, perhaps disabling markers).

An alternative approach which satisfies memory limits (and your patience while running latex) and still uses pgfplots for the axis descriptions is to employ its \addplot graphics method: there, you can generate the visualization (scatter plot?) with gnuplot, but you configure gnuplot to EXCLUDE any axis. Then, you include the generated graphics (as .eps or .png) into pgfplots, configuring only the data limits. PGFPlots will then include the graphics and will overlay its axis descriptions automatically (based on your supplied data limits). The pgfplots manual contains an example (even one which takes its image data from gnuplot output).


I think in this case I'd decimate the data before sending it to pgfplot. Consider that if your graph is, say, at most 10cm wide, having that many data points means they could be as close together as one micrometer, which you'll certainly never be bake to discern in the output.


With the default memory limits in TeXLive 2009 (3000000), I determined the limit to be 12175 points using only points (no lines). The number can vary depending on other plots in the same page and other factors, like point decorations. See the comments in How can one predict pgfplots memory overload?


If you want, pgfplots can decimate the data by itself, using the each nth point={x}, to be used as follows:

\addplot table [each nth point={100},...] {your/table/here}; 

In the example, pgfplots will plot 1 out every 100 points in the data set. You can play with the number until pgfplots does not return error and your plot looks good. I recommend to also externalize such compilation-intensive plots.

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.