在下面的直方图中,my.dat
我希望nodes near coords
取数字值,后跟文本。例如:
nodes near coords = {<Label> from \cite{<Cite>}}
我使用的代码是:
\begin{filecontents}{my.dat}
y x Label Cite
1 0.9 AK Hong
2 1.4 RE Teng
3 2.1 QP Smith
4 0.7 LR Croqa
\end{filecontents}
\begin{tikzpicture}
\begin{axis}[
xbar,
width=8cm, height=5cm,
axis lines*=left,
xlabel={},
yticklabels from table={my.dat}{Label},
ytick=data,
xticklabel={},
nodes near coords={'Own Label' from \cite{'Own Cite'}},
nodes near coords align={horizontal},
]
\addplot table [x=x, y=y] {my.dat};
\end{axis}
\end{tikzpicture}
结果如下:
答案1
这就是你想要的吗?我使用了一些来自biblatex-examples.bib
以下代码的随机条目。
\documentclass[10pt,a4paper]{article}
\usepackage{booktabs}
\usepackage{textcomp}
\usepackage{siunitx}
\usepackage{pgfplotstable,filecontents}
\pgfplotsset{compat=1.12}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\begin{filecontents*}{my.dat}
y x Label Cite
1 0.9 AK aksin
2 1.4 RE angenendt
3 2.1 QP bertram
4 0.7 LR doody
\end{filecontents*}
\noindent\begin{tikzpicture}
\begin{axis}[
xbar,
width=8cm, height=5cm,
axis lines*=left,
xlabel={},
yticklabels from table={my.dat}{Label},
ytick=data,
xticklabel={},
nodes near coords={\thenumber{} from \cite{\thecitation}},
nodes near coords align={horizontal},
visualization depends on={value \thisrow{Cite} \as \thecitation},
visualization depends on={value \thisrow{x} \as \thenumber},
]
\addplot table [x=x, y=y] {my.dat};
\end{axis}
\end{tikzpicture}
\printbibliography
\end{document}