change thickness median line geom_boxplot()

拜拜、爱过 提交于 2019-11-29 06:46:23

This solution is not obvious from the documentation, but luckily does not require us to edit the source code of ggplot2. After digging through the source of ggplot2 I found that the thickness of the median line is controlled by the fatten parameter. By default fatten has a value of two:

require(reshape)
require(ggplot2)
cars_melt = melt(cars)

ggplot(aes(x = variable, y = value), data = cars_melt) + 
  geom_boxplot(fatten = 2) 

But if we increase the value to for example 4, the median line becomes thicker.

ggplot(aes(x = variable, y = value), data = cars_melt) + 
  geom_boxplot(fatten = 4) 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!