TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using pgfplots to plot two filled curves. I'd like them to overlap transparently so that the "lower" figure can be seen through the "upper one". Using the forget style mode will draw the first figure transparently, but that's the one that is below !


  \begin{axis}[ybar,bar width=2pt]
  \addplot[color=red,mark=,draw=red,fill opacity=0.5] table[x=0,y=1]\transtable;
  \addplot[color=blue,mark=,draw=blue,fill opacity=0.5] table[x=2,y=3]\transtable;

Is there a direct way to get somewhat transparent overlapping plots ?

share|improve this question
add fill opacity=0.5 to the addplot command and please include a simple MWE which in this case 6-7 lines long so easier than typing out the question :). – percusse Dec 5 '12 at 0:34
The problem with what you recommend is that it doesn't appear to work for bar charts. – Suresh Dec 5 '12 at 0:48
I think I figured out my problem. I need to use draw opacity instead of fill opacity. Not sure whether I should delete the question. Ideally @percusse can post an answer and I'll accept it, since that's what got me on the right track. – Suresh Dec 5 '12 at 0:53
up vote 14 down vote accepted

You can use fill opacity key to change the ...hmm... fill opacity.

  \addplot[red,no marks,fill] {x} \closedcycle;
  \addplot[no marks,fill,blue,fill opacity=0.2,samples=100] {10*sin(x*20*pi)} \closedcycle;

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.