【问题标题】:How can I visualize a histogram graphics in R with the y axis in log10 scale? [duplicate]如何在 R 中使用 log10 比例的 y 轴可视化直方图图形? [复制]
【发布时间】:2018-09-01 05:52:33
【问题描述】:

我想在R中可视化一个直方图图形。问题是数据的分布是高度指数的,如下图

【问题讨论】:

  • 好的,非常感谢!下次添加问题之前我会更加小心,以便更好地搜索。

标签: r graphics visualization


【解决方案1】:

将直方图保存为变量,然后将 log10 应用于 bin 计数。将 -Inf 值设置为 0,然后绘制新计数。

# make histogram of the data
h <- hist(data)

# log10 the counts per histogram bin
h$counts <- log10(h$counts)

# set the -Inf values to 0
h$counts[!is.finite(h$counts)] <- 0

# plot the log10 counts
plot(h)

【讨论】:

    猜你喜欢
    • 2012-07-30
    • 1970-01-01
    • 2014-04-06
    • 1970-01-01
    • 2013-02-07
    • 2011-12-11
    • 2013-02-05
    • 2023-03-24
    相关资源
    最近更新 更多