[英]ggplot with extreme values
Have two questions - 有两个问题-
1.What could be the best way to show / compare extreme values. 1.什么是显示/比较极限值的最佳方法? The T group in the graph has value but no where close to the other groups, M & F
图中的T组有值,但与其他组M和F接近
Assume a data.frame like the following: 假设一个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))
You can specify a log scale axis so that you can see both big and small values (uses log distance on the y axis) and also specify labels = comma
from the scales
library inside the scale_y_log10
function to print 'nice' numbers instead of scientific: 您可以指定对数刻度轴,这样既可以看到大的值,也可以看到小的值(在y轴上使用对数距离),还可以在
scale_y_log10
函数内部的scales
库中指定labels = comma
,以打印“ nice”数字而不是科学数字:
See the following: 请参阅以下内容:
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.