具有极值的 ggplot

ggplot with extreme values

有两个问题-

1.What 可能是显示/比较极值的最佳方式。图中的 T 组有价值,但没有接近其他组的地方,M & F

  1. 我可以在 Y 轴上显示正确的数字而不必除以 1000 吗?

假设 data.frame 如下所示:

#big values ranging from 10 to 100000 which would normally
#result to 10 not being shown
df <- data.frame(names=letters[1:3], values=c(100000,1000,10))

您可以指定一个对数刻度轴,以便您可以看到大小值(在 y 轴上使用对数距离),还可以从 scales 库中指定 labels = comma scale_y_log10 函数打印 'nice' 数字而不是科学数字:

查看以下内容:

library(ggplot2)
library(scales) #you need this for labels = comma
ggplot(aes(x=names, y=values), data=df) + geom_bar(stat='identity') + 
  #scale_y_log10 will log scale the y axis
  #labels = comma will create nice numbers
  scale_y_log10(labels = comma)