如何用 pgfplot/tikz 绘制覆盖条形图的比较?

如何用 pgfplot/tikz 绘制覆盖条形图的比较?

我有使用 pgfplot/tikz 绘制叠加条形图的代码。但是,我想绘制另一组数据进行比较。你能帮我做一下吗?也就是说,我有像“II I”这样的叠加条形图,我想绘制像“II II II”这样的叠加条形图的比较。希望一切都清楚。谢谢!

\begin{figure}
    \centering
    \begin{tikzpicture}
    \begin{axis}[
        ybar stacked,
        bar width=15pt,
        ymin=0,ymax=300,
        % nodes near coords,
        enlarge x limits=0.15,
        legend style={at={(0.5,1)}, anchor=north,legend columns=-1},
        ylabel={Percentage (\%)},
        ylabel near ticks,
        symbolic x coords={Q1, Q2, Q3},
        xtick=data,
        % x tick label style={rotate=45,anchor=east},
        ]
        \addplot+[ybar] plot coordinates {(Q1, 43) (Q2, 23) (Q3, 14)};
        \addplot+[ybar] plot coordinates {(Q1, 34) (Q2, 36) (Q3, 39)};
        \addplot+[ybar] plot coordinates {(Q1, 34) (Q2, 36) (Q3, 39)};
        \addplot+[ybar] plot coordinates {(Q1, 34) (Q2, 36) (Q3, 39)};
        \addplot+[ybar] plot coordinates {(Q1, 34) (Q2, 36) (Q3, 39)};
        \legend{1, 2, 3, 4, 5}
        \coordinate (A) at (100,143);
        \coordinate (B) at (20,203);
        \end{axis}
        \node at (A) {test};
        \node at (B) {test 2};
    \end{tikzpicture}
    \caption{The satisfaction of learning experience with the virtual reality lab.}
    \label{fig:experience}
\end{figure}

相关内容