I have a problem like the one in this question, concerning a tikz drawing but for a pgfplots plot. I want to create a plot that has one region filled without opacity and a neighboring one filled with opacity. The opaque region should be coated by a solid line. I managed to get pretty much what I want with this code:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\usepackage{pgfplotstable} % For \pgfplotstableread
\usepgfplotslibrary{external}
\tikzexternalize
\usepackage{filecontents}
\begin{filecontents}{total.dos}
0 0 0 0 0
1 2 -2 2 -2
2 4 -4 4 -4
3 2 -2 2 -2
4 0 0 0 0
5 1 -1 0 0
6 2 -2 0 0
7 1 -1 0 0
8 0 0 0 0
THIS WAS: TOTAL
\end{filecontents}
\pgfplotstableread[comment chars={T}]{total.dos}\total
\begin{document}
% Set a filename for the next tikzpicture.
\tikzsetnextfilename{total_dos}
\begin{tikzpicture}
\begin{axis}[ymax=7, ymin=-7, xlabel={Energy [eV]}, ylabel={Intensity}, legend pos=north east]
\addplot [restrict x to domain=4:8, no markers, draw=red, fill=red, fill opacity=0.3] table [x=0, y expr=\thisrowno{2} - \thisrowno{4}] {\total}; \addlegendentry{$2-4$}
\addplot [restrict x to domain=4:8, no markers, draw=blue, fill=blue, fill opacity=0.3] table [x=0, y expr=\thisrowno{1} - \thisrowno{3}] {\total}; \addlegendentry{$1-3$}
\addplot [restrict x to domain=0:4, no markers, draw=blue , fill=blue] table [x=0, y=3] {\total}; \addlegendentry{$3$}
\addplot [restrict x to domain=0:4, no markers, draw=red, fill=red] table [x=0, y=4] {\total}; \addlegendentry{$4$}
\end{axis}
\end{tikzpicture}
\end{document}
This gives the following picture:

The problem is the intersections of the coating lines' ends (those that come from the draw=<color> options). They are not smooth, but look like this:

My question: How can I get these things smooth?
Side note: I know that using the option draw=none gives the behaviour I want, but then I have no line surrounding the opaque region.

line cap=roundas an option to the\addplotcommands do what you want? – Jake Jan 23 '12 at 0:19triangle 90 caparrow fromarrowslibrary can increase the blend feel. – percusse Jan 23 '12 at 0:58tikzand couldn't get your suggestion to work. I loaded\usetikzlibrary{arrows}in the preamble and tried to use the optionline cap=triangle 90 capafteraddplotbut that didn't work. Was this all wrong? I expect it to look similar toline cap=round. But those are just workarounds. Will it be possible to make the lines really blend like in thetikzquestion I linked? – Philipp Jan 23 '12 at 1:32