I'm trying to use tikz and pgfplots to draw graphics made in R using ggplot but I've been running into the memory cap in TeX:
TeX capacity exceeded, sorry [main memory size=3000000]. \end{tikzpicture}
what seems to be happening is the graph is too large and the memory for compiling the document is maxed out, there is apparently an externalize function that builds the plots individually but I can't get it to work, I'm still getting a memory full error after calling the external function. I've enabled shell escape for this document and attempted the code seen below in addition to trying to use the pgfplots external function.
% !TeX document-id = {7d5430ab-11da-4426-8450-fdab6517066c}
% !TeX TXS-program:compile = txs:///pdflatex/[--shell-escape]
\documentclass[]{article}
\usepackage[left=3cm, right=3cm, top=2cm]{geometry}
\usepackage[hidelinks]{hyperref}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
\usepackage{eurosym}
\usepackage{pgfplots}
\usepackage{shellesc}
% need to use external package to build each graphic separately so they don't
% max out latex's memory
\tikzexternalize
\pgfplotsset{compat=1.16}
I found what seemed to be a promising answer on this site in
How to expand TeX's "main memory size"? (pgfplots memory overload)
but this solution no longer seems to work, \usepgfplotslibrary{external} no longer refers to anything, which is not surprising given the answer is almost 10 years old, and the tikz externalize function also does not work, I still get the memory limit error message . I'm using the MiKTeX distribution with the TeXStudio editor if that matters. I've cut back the complexity of the graph that triggered this issue but it doesn't seem to have resolved anything, and I need to add more graphics so I'm not sure raising the memory limit would help- any help would be appreciated.
EDIT: clarified error message and some other corrections based on feedback from schtandard
\tikzexternalizetwice? Does the foldertikz/exist? – schtandard Sep 08 '19 at 06:36miktex, i use the--extra-mem-top=...and--extra-mem-bot=...options. – BambOo Sep 08 '19 at 12:27tikz/does exists and why you call\tikzexternalizetwice. And most importantly we you still didn't provide a minimal working example (MWE) so we can reproduce your problem and maybe find an answer. Sorry, without more detailed information it is very unlucky that someone will be able to help you. – Stefan Pinnow Sep 09 '19 at 05:02I thought externalize was not loading but after implementing BambOo's solution the graph still will not compile with the maximum extra memory my compiler will load. My graph has too many datapoints to compile on my current system, I had not realized that a large number of points was an issue for tikz and pgf plot, I'm going to have to export the graph as a png. Thank you for the help.
– Daniel Wagner Sep 09 '19 at 05:54