
TiKZ を使用して棒グラフのセットを作成しようとしましたpgfplots
が、何らかの理由で、グラフにグリッドが追加されていない場合でも、グラフの X = 1 に垂直グリッドが表示されます。
これを解決する方法はありますか? MWE は次のとおりです:
\documentclass{article}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin = 0, xmax = 4,
ymin = 0, ymax = 0.2,
yticklabel={\pgfmathparse{\tick*100}\pgfmathprintnumber{\pgfmathresult}\%},
xlabel = X, ylabel = Y,
ybar interval=1,
bar width=25pt,
legend style={cells={anchor=center, fill}, nodes={inner sep=1,below=-1.1ex}},area legend,
legend pos=outer north east
]
\addplot [color = red, fill = red, ybar]
coordinates{(1,0.1632003)
};
\addplot [color = green, fill = green, ybar]
coordinates{(2,0.132558)
};
\addplot [color = blue, fill = blue, ybar]
coordinates{(3,0.1173594)
};
\draw [black, thick] (axis cs:0,0) -- (axis cs:7,0);
\legend{A, B, C}
\end{axis}
\end{tikzpicture}
\end{document}
プレビュー:
答え1
ybar interval
描画には少なくとも2つの座標が必要です間隔。しかし、その後 に戻りますybar
。したがって、ybar interval
ガイド幅はゼロになります。