# How can I draw 25 horizontal lines instead of these 25 marked samples?

Instead of the samples which were marked via mark=-, I would like to have horizontal lines that fill the entire axis from left to right. Had the idea to tune the dashes via mark size=6cm but I did not find out how to clip them at the plot's borders.

## MWE

\documentclass[a4paper
]{scrartcl}

\usepackage{
tikz,
pgfplots,
amsmath
}

\usepackage[T1]{fontenc}
\usepackage{
lmodern,
textcomp,
siunitx
}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[
height=5cm,
width=6cm,
scale only axis=true,
%
xlabel={$$\alpha$$ in \si{\degree}},
ylabel={$$\sin{(\alpha)}$$},
%
xtick=\empty, ytick=\empty, xticklabels={,,}, yticklabels={,,}, xmajorgrids={false}, ymajorgrids={false}
]
\addplot+[domain=0:360, samples=25, only marks, mark=-] {sin(x)};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

-
You mean xcomb? – percusse Apr 27 '14 at 14:43
I think it might work, but how would I get them to the right edge? – henry Apr 27 '14 at 14:48
You could abuse grid lines: use ytick=data and activate grid lines for y. Would that be acceptable or do you ever need y tick labels? – Christian Feuersänger Apr 27 '14 at 14:56
@ChristianFeuersänger Yes, I do. It's just one of four pictures in a group plot for a little showcase of quantization. – henry Apr 27 '14 at 15:04
@percusse I think it might work, but how would I get them to the right edge? – henry Apr 27 '14 at 15:05

\documentclass[a4paper]{scrartcl}

\usepackage{
tikz,
pgfplots,
amsmath
}

\usepackage[T1]{fontenc}
\usepackage{
lmodern,
textcomp,
siunitx
}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\small]
\begin{axis}[
height=5cm,
width=6cm,
scale only axis=true,
%
xlabel={$$\alpha$$ in \si{\degree}},
ylabel={$$\sin{(\alpha)}$$},
%
xtick=\empty, ytick=\empty, xticklabels={,,}, yticklabels={,,}, xmajorgrids={false}, ymajorgrids={false},
after end axis/.code={
\foreach \i in {90,105,...,270} {% to avoid duplicated lines
\pgfmathparse{sin(\i)} ;
\draw(axis cs:\pgfkeysvalueof{/pgfplots/xmin},\pgfmathresult)--(axis cs:\pgfkeysvalueof{/pgfplots/xmax},\pgfmathresult) ;} ;
}
}
]
\addplot+[domain=0:360, samples=25, only marks, mark=-] {sin(x)};
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}

-
To avoid that 4pt offset, you can use \draw(axis cs:\pgfkeysvalueof{/pgfplots/xmin},\pgfmathresult)--(axis cs:\pgfkeysvalueof{/pgfplots/xmax},\pgfmathresult) ; – Torbjørn T. Apr 27 '14 at 14:58
Done, thanks for the tip I didn't knew. – Tarass Apr 27 '14 at 15:01
Unsurprisingly, I got it from this site myself. tex.stackexchange.com/questions/22018 tex.stackexchange.com/questions/124199 – Torbjørn T. Apr 27 '14 at 15:05