0

I am trying to plot a logscaled, neighbored, barplot with ggplot().

Code snippet:

ggplot(df, aes(benchmarks, runtime, fill=env))+
geom_bar(stat="identity", position="dodge") +
scale_y_log10()

Output:

ggplot

The boxes' origin is at '1', but I want them at '0.01', much like this barplot:

barplot

What am I doing wrong?

camille
  • 16,432
  • 18
  • 38
  • 60
AlKappa
  • 3
  • 3
  • 2
    What you're doing wrong is using a log scale for a bar plot :) There are good reasons not to do so, explained very well [in this answer](https://stackoverflow.com/questions/9502003/ggplot-scale-y-log10-issue). – neilfws Aug 06 '18 at 23:13
  • You can use `geom_rect` instead of `geom_bar` and set all the minima to 0.01 instead of 0. But I'd agree with neilfws that log-scaled barplots are terrible. – Gregor Thomas Aug 06 '18 at 23:22
  • I did a bad search job there. Thank you for your answers, I will not use geom_bar with scale_y_log10 anymore. – AlKappa Aug 07 '18 at 11:23

0 Answers0