[Tex/LaTex] Using a character as mark in pgfplots

pgfplots

I have a scatter plot in pgfplots which shows dots in 4 different colors belonging to 4 different sources. I would like to use a character (e.g., "A") instead of a circle as the marker. For instance, all points of the first source will be shown by small "A"s and so on.

Here is the code that I currently use.

\begin{tikzpicture}[scale=0.45]
\begin{axis}[xlabel=X,ylabel=Y]
\addplot[visualization depends on={\thisrow{nodes}\as\myvalue}, scatter/classes={         a={mark=*,blue}, b={mark=*,red}, c={mark=*,black}, d={mark=*,orange} }, scatter, only marks, scatter src=explicit symbolic]
table[x=x,y=y,meta=label] {plots/data.csv};
\end{axis}
\end{tikzpicture}

Best Answer

Just use a text mark, example:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{plotmarks}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[enlargelimits=false]
    \addplot+[only marks, samples=20, mark=text, text mark=A] {rand};
  \end{axis}
\end{tikzpicture}
\end{document}

Result

The text marks can also be set as node with more options, e.g.:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{plotmarks}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[enlargelimits=false]
    \addplot+[
      only marks,
      mark=text,
      text mark=A,
      text mark as node,
      text mark style={%
        font=\small,
        circle,
        inner sep=.1em,
        fill=blue!10!white,
        draw=blue,
      },
      samples=20,
    ] {rand};
  \end{axis}
\end{tikzpicture}
\end{document}

Result with circle nodes