I am making bar charts using pgfplots and I would like to change the font of the "data labels" to a sans-serif font (preferably Myriad Pro), but I'm having no luck. I am compiling with XeLaTeX
I've tried to use the package mathastext
as suggested here (pgfplots - How to get the y axis in sans serif), but my data labels are displayed as serif.
Here is a minimum working example: Any thoughts on how to change the data labels to sans-serif? Thank you!!
\documentclass{article}
\usepackage{fontspec}
\usepackage{pgfplots}
\defaultfontfeatures{Ligatures=TeX}
\setromanfont{Myriad Pro}
\setsansfont{Myriad Pro}
\renewcommand\familydefault{\sfdefault}
\usepackage{mathastext}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
symbolic y coords={
{Disability},
{Death},
{Congenital Anomaly}
}, % name of categorical data
ytick=data,
]
\addplot[
xbar,
fill={black},
nodes near coords, % adds data labels on each bar
nodes near coords align={horizontal}, % aligns data labels on each bar
nodes near coords style={font=\large}
] coordinates {
(10,{Congenital Anomaly})
(1199,{Death})
(285,{Disability})
};
\end{axis}
\end{tikzpicture}
\end{document}