# pgfplots: non uniform line width for interrupted plot

I draw a graph, but the red line does not appear to have the same width everywhere. For instance, between [a,b] it looks like it's thicker.

\documentclass{beamer}
\usetheme{CambridgeUS}

\usepackage{pgfplots}
\pgfplotsset{compat=1.7}

\begin{document}
\begin{frame}

\begin{tikzpicture}
\pgfplotsset{every axis plot/.style={line width=1pt}}
\begin{axis}[x                 = 1cm,
y                 = 3cm,
axis x line       = bottom,
axis y line       = center,
xmin              = -.5,
xmax              = 4,
ymin              = 0,
ymax              = 1,
enlarge x limits  = 0.05,
xlabel            = $y$,
xlabel style      = {at={(axis description cs:1.05,0)}},
ylabel            = $p_X(y)$,
ylabel style      = {at={(axis description cs:-.1,1.05)}},
unbounded coords  = jump,
xtick             = {1,2.5},
ytick             = 0.5,
xticklabels       = {$a$,$b$},
yticklabels       = {$\frac{1}{b-a}$},
xticklabel style  = {anchor = base, yshift =-\baselineskip}]
\addplot+[every mark/.append style = {mark size=1.5,fill=red}, mark indices = {3,4}, red] coordinates {(-.5,0)(1,0)(nan,nan)(1,.5)(2.5,.5)(nan,nan)(2.5,0)(4,0)};
\end{axis}
\end{tikzpicture}

\end{frame}

\end{document}

-

The axis lines are clipping your plot by default hence adding clip=false option to your wonderfully indented code solves that issue.
I have had the same problem recently and indeed the clip=false was the solution but to me this behaviour doesn't make that much sense as if you use markers, the markers do not get clipped but the lines do. A Behaviour where only the points which coordinates are outside the defined plot area get clipped, but if it is only the line thickness for data point inside the plotting area, then it really should not get clipped. –  ArTourter Jan 2 '13 at 1:58
@ArTourter You can also make the markers clipped via clip marker paths=true option. You can also play around with different layers so it's quite flexible. –  percusse Jan 2 '13 at 2:05