0

I display a boxplot chart as following:

enter image description here

But what I would like is to have the x axis as real x axis, meaning that the space between values should be respected. Adding to this scale I would like a log scale on the x axis. How can I do this using geom_boxplot?

thanks, Jerome

user1595929
  • 1,284
  • 3
  • 13
  • 23
  • Please read (1) [how do I ask a good question](http://stackoverflow.com/help/how-to-ask), (2) [How to create a MCVE](http://stackoverflow.com/help/mcve) as well as (3) [how to provide a minimal reproducible example in R](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example#answer-5963610). Then edit and improve your question accordingly. – lukeA Jun 23 '16 at 08:52

1 Answers1

2

what I would like is to have the x axis as real x axis, meaning that the space between values should be respected. Adding to this scale I would like a log scale on the x axis. How can I do this using geom_boxplot?

You could do

set.seed(1)
df <- data.frame(x=rep(c(1,10,50,100), each=10), y=runif(40))
library(ggplot2)
ggplot(df, aes(x, y, group=x)) + 
  geom_boxplot() + 
  scale_x_log10() + 
  theme_minimal()

enter image description here

lukeA
  • 53,097
  • 5
  • 97
  • 100