答案1
我相信你只要看一看手册就能弄清楚大部分内容(手册中有很多虽然有很多例子,但这里有一个建议。
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
symbolic x coords={Low age,High age},
xtick=data,
ymin=1,ymax=6,
enlarge x limits=0.5,
legend entries={Low gender, High gender},
legend pos=outer north east
ylabel=Dependent variable
]
\addplot coordinates {(Low age,2)(High age,2.5)};
\addplot coordinates {(Low age,2.2)(High age,2.9)};
\end{axis}
\end{tikzpicture}
\end{document}