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

Consider the following MWE:


\usetikzlibrary{intersections} %% named intersections "I do not know the key '/tikz/name path global'"


\pgfplotstableread[col sep=&,row sep=\\]{
  0.0159779999812599 & 0.00398599999607541 \\
  0.0240009999834001 & 0.00802300000214018 \\
  0.0240489999996498 & 4.80000162497163e-05 \\
  0.0280280000006314 & 0.00397900000098161 \\


  title={\small my data},
  title style={at={(0.5,0.9)},anchor=center},
  axis x line=middle,
  axis y line=middle,
  y axis line style=-,
  xmin = 2e-3,
  xmax = 38e-3,
  ymin = 0,
  ymax = 1.5,
  xlabel style={at={(axis description cs:1.01,+0.0)},anchor=west},
  ylabel={}, %{$U$\,[V]},
  ylabel style={at={(axis description cs:-0.02,1.01)},anchor=south},
  scaled x ticks=base 10:3,
  xtick scale label code/.code={},
  x tick label style={
    /pgf/number format/fixed,
    /pgf/number format/fixed zerofill,
    /pgf/number format/precision=3,
  tick label style={font=\small,},
  legend cell align=left,
  legend pos=outer north east,

  name path global=afunc,
%   opacity=0.2, % global
  mark=*, mark options={
    opacity=0.2, % on mark
  line width=2pt,
  table[x index = 0,y expr=1] \mytable ;



With the code as is, evince renders the pdf as (click for full size img):


with the "% global" opacity enabled, the pdf is rendered as:


... however, what I want is that the "impulses" are transparent, so they get a more intense color when they overlap - and neither of the above images shows that: the global one is, well, global - and the "local" one applied to the mark style seems ignored?

Also, any way to get the marks (circles) of the impulses to be completely filled? (it looks as if there is a hole inside, if you look closely at the full size images)

Any way to achieve what I want? The log file says:

Package: pgfplots 2011/12/29 v1.5.1 (git show 1.5.1-4-g53e640f )

share|improve this question
Your pgfplots is quite outdated. Regardless of the solution, you should try an update. Also mark options is relevant here. – percusse Mar 17 '14 at 10:20
Thanks @percusse - an update is planned, but cannot be done in the near future. Also, I think I already use mark options in the code? Cheers! – sdaau Mar 17 '14 at 10:22

Well, I got a sort of a hack to work: first, I tried ybar style, which is sort of similar - but it seems it too applies opacity/transparency on the graph as a whole - not to individual bars/lines.

So I tried looping through the table data and drawing individual lines with opacity - and that finally seems to have worked; the relevant changes in the above MWE are:



  name path global=afunc,
  only marks, %ycomb,
  draw=none, %black,
  %opacity=\opac, % global
  mark=*, mark options={
    draw=none, %black,
    opacity=\opac, % on mark; both stroke and fill (and stroke will overlap fill - twice the opacity!? even with draw=none?)
  %line width=2pt, % also changes the line around the mark!
  table[x index = 0,y expr=1] \mytable ;

% \addplot[
%   name path global=afuncb,
%   ybar,
%   bar width=2pt,
%   %fill=black,
%   %draw=none,
%   opacity=0.4,
% ]
%   table[x index = 0,y expr=1] \mytable ;

  % \node{I have now cell element ‘\cx’ at row index ‘\pgfplotstablerow’;\par};
  \edef\temp{ %
      line width=2pt, %semithick,
    ] ({axis cs:\cx,0}) -- ({axis cs:\cx,1}); %


... and the output is:


I left the "only marks" style just for easier visual comparison of overlaid color. The only thing that bothers me now is a visible stroke around the circular marks, but that's no biggie ...

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.