格子上的直方图
由于基本 R 的 hist()
不报告百分比(并且 freq=FALSE)也没有帮助,因此我转向了 lattice
。
histogram(rnorm(10000))
请帮助我解决以下问题:
- 我怎样才能摆脱情节周围的框?
- 如何分别定义x/y标签和x/y轴的cex?
- 如何为 x 轴和 y 轴提供自定义名称?
Since hist()
of the base R does not report percentages (and the freq=FALSE) does not help either, I turned to lattice
.
histogram(rnorm(10000))
Please help me with the following:
- How can I get rid of the box arround the plot?
- How can I seperately define the cex of the x/y labels and x/y axis?
- How can I provide custom names to x and y axis?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者,如果您想坚持使用
hist()
,您可以稍微修改它,如下所示。该函数调用一次
hist()
来获取其返回值,该返回值是一个包含有关直方图结构的各种有用信息的对象。然后,它使用 (a) 箱的宽度和 (b) 每个条形的密度来计算 (c) 每个条形中观测值的百分比。Or, if you want to stick with
hist()
, you can modify it slightly, as shown below.This function calls
hist()
once to get its return value, which is an object containing all sorts of useful information about the structure of the histogram. It then uses (a) the width of the bins and (b) the density for each bar to calculate (c) the percentage of the observations falling in each bar.这应该可以帮助您开始:
This should get you started: