Reputation: 710
Was produced with this code:
x <- data.frame("col1"=c(7.2,4.3,4.1,3.1,
1.6,1,0.8,0.4,0.5,
0.4,0.3,0.2,0.04,0.1,0.1),
"col2"=c(3.9,2.4,2.0,4.8,1.3,
1.0,1.1,0.8,0.6,0.9,1.1,
0.9,0.5,0.7,0.7))
p <- ggplot(x, aes(x=col1,y=col2)) + geom_point()
p <- p + scale_y_continuous(breaks = c(0.01,.1,1,10),limits = c(0,10))
p <- p + scale_x_continuous(breaks = c(0.01,.1,1,10),limits = c(0,10))
I am trying to achieve even spacing between 0.01, .1, 1, and 10 so that it is easier to see the difference between the smaller values. The only thought I had was to log transform the axes, but are there any other reasonable approaches?
Upvotes: 0
Views: 979
Reputation: 13793
If you wanted to spread out the data, then a log transform is probably the easiest option. Moreover, log transforms are pretty common, so to the observer of your plot, it would not be too difficult to ascertain what's going on. Regardless, it is always a suggestion to make it obvious what is happening, so you would typically want to change the axis title to reflect that.
Here's a suggestion with the data you indicate that works quite well:
p + scale_x_log10(name='log col1', limits=c(0.01,10))
Note of course that the plot cannot start at 0, since log10(0)
is -Inf
.
Upvotes: 1