Tikzpicture:放大切断情节的另一面

时间:2016-05-24 16:03:53

标签: plot latex bar-chart tikz

我想在条形图中的条形图上方放置一些文字标签。为了给它们腾出空间,我尝试使用enlarge limits,但看起来它会改变我的整个情节,切断底部。我怎么能解决这个问题?

我附加了代码,原始图和行enlarge y limits未注释的图片。

\begin{tikzpicture}
\begin{axis}[
    xlabel = {loss},
    ylabel = {probability},
    enlarge x limits=0.2,
    %enlarge y limits={rel=0.2,upper},
    bar width = 16pt,
    width=14cm,
    height=8cm,
    xtick=data]
    \addplot[ybar,fill=white] coordinates {(-10,0.9) (0,0.095) (95,0.005)};
    \node[above] at (axis cs:-10,0.9) {$90\%$};
    \node[above] at (axis cs:0,0.095) {$9.5\%$};
    \node[above] at (axis cs:95,0.005) {$0.5\%$};
\end{axis}
\end{tikzpicture}
\end{figure}

original plot shifted plot

1 个答案:

答案 0 :(得分:1)

好的,我发现我可以使用ymax获得所需的效果:ymax=1.1

solution