I want to use markers form \usetikzlibrary{plotmarks}, like: pentagon*, diamond*, square* and triangle* in the title of the plot. They work as markers in the plot but i get an error when in want to include them in the title (instead of the "x" in \mathbf{})
This is my code:
\begin{filecontents*}{data.txt}
b d c
1 a 2
2 b 4
3 c 6
4 d 8
5 e 10
6 f 12
7 g 14
8 x 16
9 x 18
\end{filecontents*}
\documentclass[paper=a4,ngerman,xcolor=dvipsnames]{article}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{siunitx}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{lipsum}
\pgfplotscreateplotcyclelist{mycolorlist}{
blue!01!green,every mark/.append style={fill=blue!10!black},mark=+\\
}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[
grid=both,
width=12cm,
height=9cm,
xtick pos=left,
ytick pos=left,
title style={draw,fill=none,name=legend},
title={%
${\color{red}\mathbf{x}}=\SI{100}{\kilo\Hz}$,
${\color{red}\mathbf{x}}=\SI{10}{\kilo\Hz}$,
${\color{red}\mathbf{x}}=\SI{1}{\kilo\Hz}$,
${\color{red}\mathbf{x}}=\SI{100}{\Hz}$,
${\color{red}\mathbf{x}}=\SI{10}{\Hz}$,
${\color{red}\mathbf{x}}=\SI{1}{\Hz}$},
xlabel={R}, ylabel={Z},
legend style={at={(0.02,0.98)},anchor=north west,cells={anchor=west}},
legend style={font=\footnotesize},
cycle list name=mycolorlist,
scatter,
point meta=explicit symbolic,
scatter/classes={
x={},% empty argument means: use the default style
g={mark=o,red!10!black},
f={mark=square*,red!20!black},
e={mark=diamond*,red!30!black},
d={mark=triangle*,red!40!black},
c={mark=pentagon*,red!50!black},
b={mark=*,red!60!black},
a={mark=oplus,red!70!black},
z={mark=*,red!80!black}
},
]
\addplot table [x=b,y=c, meta=d]{data.txt};
\legend{Z}
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
\pgfuseplotmark{square*} works but it also changes the title.
.
.
.
title style={draw,fill=none,name=legend},
title={%
${\color{red}\pgfuseplotmark{o}}=\SI{100}{\kilo\Hz}$,
${\color{red}\pgfuseplotmark{square*}}=\SI{10}{\kilo\Hz}$,
${\color{red}\pgfuseplotmark{diamond*}}=\SI{1}{\kilo\Hz}$,
${\color{red}\pgfuseplotmark{triangle*}}=\SI{100}{\Hz}$,
${\color{red}\pgfuseplotmark{pentagon*}}=\SI{10}{\Hz}$,
${\color{red}\pgfuseplotmark{*}}=\SI{1}{\Hz}$,
${\color{red}\pgfuseplotmark{oplus}}=\SI{20}{\mHz}$},
It looks like this:
After using \def\showmark#1{\tikz[baseline]\node[red]{\pgfuseplotmark{#1}};} the problem with the y-alignment is fixed, but the title is not centered anymore.
Using \showmark{square*}=$\SI{100}{\kilo\Hz}$ instead of \showmark{x}=$\SI{100}{\kilo\Hz}$ leads to:





\pgfuseplotmark{square*}(cf. e.g. http://tex.stackexchange.com/questions/64567) works here, though the vertical alignment is off. – Torbjørn T. Jan 11 '17 at 11:54!before Undefined to the?a couple of lines later), so that we can see which macro is undefined. – Torbjørn T. Jan 11 '17 at 12:06=I see. I don't have a fix at the moment, but I'm sure someone does. – Torbjørn T. Jan 11 '17 at 12:15