7

Consider the following example from the pgfplots manual p. 164:

\documentclass{article}
\usepackage{pgfplots}

\begin{document} 
    \begin{tikzpicture}
        \begin{axis}[tiny]
        \addplot+[scatter] {sin(deg(x))};
        \end{axis}
    \end{tikzpicture}
    \begin{tikzpicture}
        \begin{axis}[tiny]
        \addplot+[scatter,mark = o] {sin(deg(x))};
        \end{axis}
    \end{tikzpicture}
\end{document}

enter image description here

As you can see the edge color of the markers is darker than the fill color. If one uses a colormap and point meta = ... to color the scatter plot, then its always the fill color which is determined by point meta = ... - the edge color is somehow set to a darker color.

In case I use mark = o or mark = x, just the edges of the markers are plotted, in the darker color. But I'd like them to be as bright as in the filled case.

So how can I make the marker edge color equal to its fill color?

I couldn't find any command in the pgfplots manual to do so.


More complex MWE

I'm using color coded plots, which can be realized by abusing \addplot[mesh]. However the meta data which is used to plot the mesh does not affect the markers, they are black. So I used \addplot[scatter], to get also color coded markers. I'd like to get circles, but in the same color as the graph. But as the circles are made by the darker edge color, it does not fit.

\documentclass[landscape]{article}
\usepackage{pgfplots}

\usepackage{filecontents}
\begin{filecontents}{data_1.dat}
    0 0
    1 1
\end{filecontents}
\begin{filecontents}{data_2.dat}
    0 0
    1 2
\end{filecontents}
\begin{filecontents}{data_3.dat}
    0 0
    1 3
\end{filecontents}

\begin{document}
    \begin{tikzpicture}
    \begin{axis}[%
    ,ymin=0,xmin=0,ymax=5,xmax=1,colorbar
    ]
    \foreach \m in {1,...,3}
        {\addplot[mesh,point meta=\m,mark=o] table {data_\m.dat};}
    \end{axis}
    \end{tikzpicture}
    \begin{tikzpicture}
        \begin{axis}[%
        ,ymin=0,xmin=0,ymax=5,xmax=1,colorbar
        ]
        \foreach \m in {1,...,3}
            {\addplot[mesh,point meta=\m] table {data_\m.dat};}
        \foreach \m in {1,...,3}
                    {\addplot[scatter,point meta=\m, only marks, mark=o] table {data_\m.dat};}    

        \end{axis}
    \end{tikzpicture}
\end{document}

enter image description here

1 Answer 1

10

The style of the markers in a scatter plot is determined using the key scatter/use mapped color={draw=..., fill=...} (see section 4.5.11 "Scatter Plots" in the manual). By default, it is set to draw=mapped color!80!black,fill=mapped color. In your case, you would want to set it to scatter/use mapped color={draw=mapped color}:

\documentclass{standalone}
\usepackage{pgfplots}

\usepackage{filecontents}
\begin{filecontents}{data_1.dat}
    0 0
    1 1
\end{filecontents}
\begin{filecontents}{data_2.dat}
    0 0
    1 2
\end{filecontents}
\begin{filecontents}{data_3.dat}
    0 0
    1 3
\end{filecontents}

\begin{document}
    \begin{tikzpicture}
    \begin{axis}[%
    ymin=0,xmin=0,ymax=5,xmax=1,colorbar
    ]
    \foreach \m in {1,...,3}
        {\addplot[mesh, scatter, scatter/use mapped color={draw=mapped color}, point meta=\m, mark=o] table {data_\m.dat};}
    \end{axis}
    \end{tikzpicture}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .