td;dr: How can I reliably reduce the number of layers in a PDF that contains pgfplotswith lots of data point.

I have made some 3D plots using pgfplots which each contain a lot of data points. They are typeset as PDF via standalone and included in the main document using graphicx:

enter image description here

I went to two local copy shops to have my document (containing roughly 20 of them included via graphicx) printed, but was told these plots cause my document to contain "too many layers" and their printing setup to "hang". I can print it without issues from a MacBook on a rather cheap consumer Canon ink jet printer, however.

Please don't suggest manual conversion to bitmaps. If conversion is absolutely required, I need to do it with the whole document and in an automatic way. There's no time to do it manually plot-by-plot.

Please also don't suggest reducing the data. The plots do look fine, compile within reasonable time (~1 min on my machine) and I absolutely cannot touch the data anymore right now.

Heres the MWE and the sample csv data can be found here on my github.

% !TeX program = lualatex
\documentclass[border={1.5cm 2pt 5mm 10pt}]{standalone}


%\setmainfont{Linux Libertine}
%\setsansfont{Linux Biolinum}




\begin{tikzpicture}[trim axis left,trim axis right]
        set layers,
        every axis plot/.append style={on layer=pre main},
        every x tick scale label/.style={
            at={(xticklabel* cs:0.8)},
            anchor=near xticklabel,
            inner sep=8pt,
            fill opacity=0.75,
        ] table [
            col sep=comma,
        ] {data.dat};
    \node at (rel axis cs:0.5,0,1) [overlay,above,sloped like x axis] {Axis A};
    \node at (rel axis cs:0,0.5,1) [overlay,above,sloped like y axis] {Axis B};


Edit: By the way, this is the how the mininimal working example is rendered in Adobe Acrobat Reader 11.0.23 on a Windows 10 machine (please oversee the axis labels which I have changed here):

enter image description here

This is obviously not acceptable and I wonder what's wrong with my code that only Acrobat fails to display it correctly. Works under Ubuntu using Eye of Gnome or qpdfview as well as under OSX using Preview.

  • well you don't leave much options to us. What do they mean by layers?Then the only option is find a proper printer – percusse Apr 27 '18 at 13:23
  • I really don't know :( – Christoph90 Apr 27 '18 at 13:23
  • Then we can't know either. This is not a well defined question – percusse Apr 27 '18 at 13:24
  • 1
    You may want to consider shader=interp. On my system, acrobat reader displays the result fine (and much faster) although it was slow and wrong with the original report. Interestingly, xpdf fails to display the combination shader=interp,* opacity... that's new to me. shader=interp is not what you had in mind, I know. And you may also need to combine it with \usepackage[cmyk]{xcolor} in order to avoid color burning (try it, you'll see what I mean). – Christian Feuersänger Apr 28 '18 at 10:50
  • 1
    Actually, I am wondering why acrobat reader applies the stroke opacity to the boundaries of the flat rectangles. Is this a bug in pgfplots? I added \let\pgfplotsplothandlermeshusepathfillstroke=\pgfplotsplothandlermeshusepathfill experimentally and the display is fine. Perhaps this would also fix the printing issue? – Christian Feuersänger Apr 28 '18 at 10:59

Your Answer

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

Browse other questions tagged or ask your own question.