代码之家  ›  专栏  ›  技术社区  ›  Erik

每个条形图下面都有文本的乳胶条形图?

  •  0
  • Erik  · 技术社区  · 1 年前

    我正试图创建这样一个图形:

    Wanted result

    但我只能使用图例文本使其看起来像这样,但我想将文本直接放在条形图下方(如0ms、50ms、150ms)

    My current try

    我的代码:

    \begin{figure}[ht]
    \centering
    \begin{tikzpicture}
    \begin{axis}[
        ybar,
        bar width=20pt,
        width=0.5\textwidth,
        height=0.5\textwidth,
        enlarge x limits=0.5, % dist between x bars
        legend style={at={(0.5,-0.20)},anchor=north,legend columns=-1},
        ylabel={Impact of latency on gameplay, 1-5},
        symbolic x coords={Chess, Pong},
        xtick=data,
        ymin=1,ymax=5,
        nodes near coords,
        nodes near coords align={vertical},
        ]
    \addplot coordinates {(Chess,1.1) (Pong,1.5)}; % 0ms results
    \addplot coordinates {(Chess,1.6) (Pong,4.6)}; % 1000ms results
    \legend{100ms delay,1000ms delay}
    \end{axis}
    \end{tikzpicture}
    \end{figure}
    
    0 回复  |  直到 1 年前