3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ggplot2で棒グラフを作る時に下のスペースをなくす

Posted at

経緯

棒グラフを描くときは、下にスペースがない方がよいと思う。

方法

最大値を直接入力する方法

ggplot(mtcars, aes(x=as.factor(carb)))+
     geom_bar()+
     scale_y_continuous(expand = c(0,0), limits = c(0,10.3))

最大値を入力しない方法(でも汚い)

ggplot(mtcars, aes(x=as.factor(carb)))+
     geom_bar()+
     scale_y_continuous(expand = c(0,0))+
     geom_blank(aes(y=1.1*..count..), stat="bin")

参考

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?