Not cropping BarChart when using Frame instead of

2019-07-20 21:35发布

I just found out that a BarChart may get cropped when using Frame rather than Axes.

Example:

data = {.2, .4, .6, 0., 0., 0.}
BarChart[data]
BarChart[data, Frame -> True, Axes -> False]

Is this a feature or a bug? If it is a feature, is there an easy way to prevent cropping?

EDIT

Screenshot, per request:

enter image description here

2条回答
淡お忘
2楼-- · 2019-07-20 22:13

Well, It was not always like that:

enter image description here

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-07-20 22:15

How about using PlotRange?...

data = {.2, .4, .6, 0., 0., 0.}
BarChart[data]
BarChart[data, Frame -> True, Axes -> False, 
PlotRange -> {{.5, 6.5}, {0, .7}}, 
FrameTicks -> {None, Automatic, None, None}]

Figure


Edit

I'm beginning to think it is indeed a bug. Look what happens if we simply change the order of the elements in data. It acknowledges (but does not display the baseline of) the bars of zero height that it previously ignored. Notice that I didn't have to tweak the display using PlotRange this time around.

Bar2

查看更多
登录 后发表回答