Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boxplot in R with only median visible

Tags:

r

median

boxplot

I want to plot only median for my two dataset. It can be also done using segments function in R but I don't know how. So, I decided using boxplot function but still couldn't figure out how to hide everything and show just medians.

Thanks

like image 486
manjovial Avatar asked Dec 04 '12 07:12

manjovial


Video Answer


1 Answers

You can set the graphical parameters which are documented under ?bxp:

boxlty: box outline type
whisklty: whisker line type
staplelty: staple (= end of whisker) line type

Setting outline = FALSE suppresses drawing outliers.

boxplot(count ~ spray, data = InsectSprays, outline = FALSE, boxlty = 0,
  whisklty = 0, staplelty = 0)

should draw a boxplot with just the horizontal lines at the medians.

like image 172
BenBarnes Avatar answered Oct 04 '22 15:10

BenBarnes