Transparent plot

Thanks couet for the instructions, I managed to get a transparent canvas in the pdf output.

Now, I tried to save the canvas as .tex

c->SaveAs("trans.tex")

and then include it in my latex document “test_transparent.tex”

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\begin{document}
\begin{figure}
\input{trans.tex}
\caption{Image ({\tt trans.tex}) generated thanks to {\tt TTeXDump}}
\end{figure}
\end{document}

When compiling with “pdflatex test_transparent.tex”, the resulting background is black (see attached pdf), so I think there is a bug in the .tex export function. If I hack the “trans.tex” file by removing these three lines, the background is correctly transparent:

\definecolor{c}{rgb}{1,1,1};
\draw [pattern=, pattern color=c] (0,0) rectangle (20,13.5632);
\draw [pattern=, pattern color=c] (0,0) rectangle (20,13.5632);

This hack removes also the bounding box (transparent space around the histogram), which is interesting as this extra white space is normally not needed when inserting into a latex document, which manages by himself the separation with normal text and so on.

But maybe, one could add a boolean option to the export function to .tex such that:

  • Normal behaviour: draw a bounding rectangle with transparent fill color (correct the “black bug”).
  • Remove bounding box behaviour: remove completely the bounding rectangle.

The second option would also be interesting for the SaveAs(".pdf") function. Otherwise, one has to open each pdf figure in inkscape, and save it again as pdf with “export area is drawing” option instead of “save area is page”.
test_transparent.pdf (30.5 KB)