3

is it somehow possible to use external pictures as explicit labels in pgfplot? Or can I use the draw environment within the label definition?

I tried it in two ways:

\begin{tikzpicture}
\begin{axis}[
xlabel={Motifs},
ylabel={Value},
xtick={1,2},
xticklabels={%
    \draw (0,0) node {} -- (2,4) node {} -- (4,0) node {};, %
    \begin{tikzpicture}[thick,xscale=0.2,yscale=0.2]%
    \draw (0,0) node {} -- (2,4) node {} -- (4,0) node {} -- (0,0);
    \end{tikzpicture}
}
]
\addplot+
table[x=motif,y=original] 
{
    motif   target  original    reached 
    2   0.0 0.36755204594400576 0.0 
    1   1.0 0.6324479540559943  1.0 
};
\end{axis}
\end{tikzpicture}

The result should look like this

pgfplot with images as xaxis labels

Thanks in advance for any hints or tips!

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – user11232 Apr 9 '15 at 16:44
2

Have you tried this?

\documentclass{standalone}
\usepackage{pgfplots}
 \usepgfplotslibrary{fillbetween}
 \usetikzlibrary{patterns}
\begin{document}
  \begin{tikzpicture}
\begin{axis}[
xlabel={Motifs},
ylabel={Value},
xtick={1,2},
xticklabels={\includegraphics[scale=0.05]{example-image-a},\includegraphics[scale=0.05]{example-image-b}
}
]
\addplot+
table[x=motif,y=original]
{
    motif   target  original    reached
    2   0.0 0.36755204594400576 0.0
    1   1.0 0.6324479540559943  1.0
};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Nice, that works. Stupid me, could have had this idea by myself .. I just made the pictures with QTikz and exported them as pdf to import them again within latex. Thanks! – Julian Apr 10 '15 at 7:59

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.