使用框架而不是轴时不裁剪条形图

发布于 2024-11-18 08:02:10 字数 388 浏览 6 评论 0原文

我刚刚发现使用 Frame 而不是 Axes 时,BarChart 可能会被裁剪。

示例:

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

这是一个功能还是一个错误?如果它是一个功能,是否有一种简单的方法可以防止裁剪?

编辑

屏幕截图,根据请求:

在此处输入图像描述

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情场扛把子 2024-11-25 08:02:10

嗯,情况并不总是这样:

在此处输入图像描述

Well, It was not always like that:

enter image description here

熊抱啵儿 2024-11-25 08:02:10

使用 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

我开始认为这确实是一个错误。看看如果我们简单地改变数据中元素的顺序会发生什么。它承认(但不显示基线)之前忽略的零高度条。
请注意,这次我不必使用 PlotRange 调整显示。

Bar2

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文