Reputation: 361
Have two questions -
1.What could be the best way to show / compare extreme values. The T group in the graph has value but no where close to the other groups, M & F
Upvotes: 2
Views: 1405
Reputation: 37879
Assume a data.frame like the following:
#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:
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)
Upvotes: 3