我有以下数据,我正在尝试显示类似于屏幕截图的图表
items,section_1,section_2,section_3,section_4
10,82,42,38,22
20,38,24,20,63
30,44,49,39,40
40,58,48,47,47
50,58,45,59,41
答案1
没有 MWE,没有解释:)
\documentclass{standalone}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread[col sep=comma]{
items,section_1,section_2,section_3,section_4
10,82,42,38,22
20,38,24,20,63
30,44,49,39,40
40,58,48,47,47
50,58,45,59,41
}\mytable
\begin{tikzpicture}
\begin{axis}
\pgfplotsinvokeforeach{1,...,4}{
\addplot table[x=items,y=section_#1]{\mytable};
}
\end{axis}
\end{tikzpicture}
\end{document}