2

I searched the documentation and didn't find anything related, but is it possible to have a transparent background for a pgfgantt object?

I'd like to put the figure into a presentation, and the text on the left is on a transparent background, but everything else in the chart has a white background. I'd like to have the \ganttbar be opaque white, but that's it.

MWE below the picture gantt image

\documentclass[12pt,border=0.5in]{standalone}
\usepackage{pgfgantt}
\begin{document}

    \begin{ganttchart}[vgrid,%hgrid,
      x unit=7mm,
      time slot format=isodate-yearmonth,
      compress calendar]{2015-09}{2016-04}
      \gantttitlecalendar{year, month} \\

      \ganttgroup{Group 1}{2015-09}{2016-04}\\
      \ganttbar{Task 1}{2015-09}{2015-11}\\
      \ganttbar[name=task2]{Task 2}{2015-10}{2015-12}\\
      \ganttbar{Task 3}{2015-12}{2016-04}\\

      \ganttgroup{Group 2}{2015-11}{2016-03} \\
      \ganttbar{Task 4}{2015-11}{2015-12}\\
      \ganttbar[name=task4]{Task 5}{2016-01}{2016-03}\\

      \ganttlink{task2}{task4}

    \end{ganttchart}
\end{document}
4

You can change the canvas style to use some filling opacity using something like:

canvas/.append style={fill opacity=0.2}

to have a semi-translucent background (0 will be completely translucent and 1 will be completely opaque). A similar addition can also be applied to the other elements, if required. A complete example in which I made completely translucent some of the elements involved and used fill opcity=0.5 for the groups so they are filled by semi-translucent:

\documentclass{beamer}
\usepackage{pgfgantt}

\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth,height=\paperheight]{papiro}}

\begin{document}

\begin{frame}
    \begin{ganttchart}[vgrid,%hgrid,
      x unit=7mm,
      time slot format=isodate-yearmonth,
      compress calendar,
      canvas/.append style={fill opacity=0},
      bar/.append style={fill opacity=0},
      group/.append style={fill opacity=0.5},
      milestone/.append style={fill opacity=0},
      title/.append style={fill opacity=0},
      ]{2015-09}{2016-04}
      \gantttitlecalendar{year, month} \\

      \ganttgroup{Group 1}{2015-09}{2016-04}\\
      \ganttbar{Task 1}{2015-09}{2015-11}\\
      \ganttbar[name=task2]{Task 2}{2015-10}{2015-12}\\
      \ganttbar{Task 3}{2015-12}{2016-04}\\

      \ganttgroup{Group 2}{2015-11}{2016-03} \\
      \ganttbar{Task 4}{2015-11}{2015-12}\\
      \ganttbar[name=task4]{Task 5}{2016-01}{2016-03}\\

      \ganttlink{task2}{task4}

    \end{ganttchart}
\end{frame}

\end{document}

The result:

enter image description here

Another option, specially of you want completely translucent elements is to use fill=none, as in

 canvas/.append style={fill=none}
  • Setting canvas/.append style={fill opacity=0} was what I was looking for. Thanks! – chasely Sep 6 '15 at 3:41
  • @chasely You're welcome! I added another option (fill=none) at the bottom of my answer; it might be of interest for you. – Gonzalo Medina Sep 6 '15 at 3:52

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.