2

Is it possible in plots created with the pgfplots package to replace data point symbols (the dot) with a homemade image or icon? Such as the bullet points in the simple graph:

enter image description here

I would like to be able to illustrate data points with a homemade small image in .jpg or .png format.

The code is like this:

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    axis lines = left,
    xmin=0, xmax=6,
    ymin=0,ymax=10,
]
\addplot[only marks] coordinates {
    (1,5)
    (2,5)
    (3,5)
    (4,5)
    (5,5)
};
\end{axis}
\end{tikzpicture}
\end{document}
5

You can use a text mark.

enter image description here

\documentclass{article}

\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    axis lines = left,
    xmin=0, xmax=6,
    ymin=0,ymax=10,
]
\addplot[
   only marks,
   mark=text,
   text mark={\includegraphics[width=10pt]{example-image}}
   ] coordinates {
    (1,5)
    (2,5)
    (3,5)
    (4,5)
    (5,5)
};
\end{axis}
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.