开发者

how to use a log scale for y-axis of histogram in R?

开发者 https://www.devze.com 2023-01-24 05:31 出处:网络
I have a l开发者_开发知识库arge dataset with the lifespan of threads on an discussion board. I wanta histogram that shows the distribution of lifespan, so I did this:

I have a l开发者_开发知识库arge dataset with the lifespan of threads on an discussion board. I want a histogram that shows the distribution of lifespan, so I did this:

dall <- read.csv("lifespan.csv")
colnames(dall) <- c("thread.id", "seconds.alive", "start.time")
hist(dall$seconds.alive)

which generated this hard to read image:

how to use a log scale for y-axis of histogram in R?

My questions are a) is changing y-axis to a log-scale a good way to make it more readable? Apparently some people think is a bad idea to change y-axis to log.

b) how do I do that?


I would try using hist(log10(dall$seconds.alive)) instead.

Also try specifying breaks=100 or smaller/larger number:

hist(log10(dall$seconds.alive), breaks=100)
0

精彩评论

暂无评论...
验证码 换一张
取 消