tikzpicture:放大截掉另一边的图
Tikzpicture: enlarge cuts off the other side of the plot
我想在条形图中的条形上方放置一些文本标签。为了给他们制作space,我尝试使用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) {\%$};
\node[above] at (axis cs:0,0.095) {.5\%$};
\node[above] at (axis cs:95,0.005) {[=10=].5\%$};
\end{axis}
\end{tikzpicture}
\end{figure}
好吧,我刚刚发现我可以使用 ymax 获得想要的效果:ymax=1.1
我想在条形图中的条形上方放置一些文本标签。为了给他们制作space,我尝试使用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) {\%$};
\node[above] at (axis cs:0,0.095) {.5\%$};
\node[above] at (axis cs:95,0.005) {[=10=].5\%$};
\end{axis}
\end{tikzpicture}
\end{figure}
好吧,我刚刚发现我可以使用 ymax 获得想要的效果:ymax=1.1