# pgfplots: filled markers without border

I am trying to draw a PGF plot with markers only. I want the markers to be filled squares, but pgfplots keeps adding a differently colored border to these marks.

How can I stop that from happening? I want plain filled squares consisting of one color each.

MWE:

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}[tiny]
mark=square*,
only marks,
mark options={draw=none}, % this line does not do anything
scatter] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}


You have to play with scatter/use mapped color option; in this case, to "remove" the border, you can set both draw and fill with the same color or you can set the draw opacity=0. The latter method makes markers' size narrow as the border is removed while the former method keeps the markers' size.

The complete example:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}
\begin{tikzpicture}
\begin{axis}[tiny]
mark=square*,
only marks,
scatter,
scatter/use mapped color=
{draw opacity=0,fill=mapped color}% to remove the border
%{draw=mapped color,fill=mapped color}% for same size
] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}


The result:

• Is there also a way to get rid of the border entirely? In a situation where the marks are tightly aligned, the border messes up measurements. Perhaps using a custom mark... Jan 14 '14 at 13:05
• @Jake: I thought about that possibility, but then the marker would be narrow. Since no clues are provided on that side I preferred to keep the same size for markers. Maybe I'll edit the answer for providing both solutions. Jan 14 '14 at 13:05