R boxplot: How to customize the appearance of the box-and-whisker plots (e.g., remove lines or borders, change symbol of outliers)

前端 未结 2 1781
-上瘾入骨i
-上瘾入骨i 2020-12-23 09:02

Today, I was wondering how to customize the appearance of the box-and-whisker plots. E.g., I wanted to remove the line around the box. However, the problem is, that the

2条回答
  •  孤城傲影
    2020-12-23 09:15

    In order to customize the appearance of the box-and-whisker plots, you have to change the med[…], box[…], whisk[…], or staple[…] argument for adjusting the line settings, or the out[…] argument for outliers.

    enter image description here

    […] needs to be replaced by one of the following line or point arguments:

    Arguments for the appearance of line elements (for more information see ?par in R):

    • lty: line style (e.g.,= 0 to remove the line,= 1 for solid line)
    • lwd: line width
    • col: line color

    Arguments for the appearance of outliers (for more information see ?points in R):

    • pch: symbol style
    • lwd: line width
    • cex: size of symbol
    • col: color
    • bg: background color

    So, here is an example of how the above boxplot might be "customized":

    boxplot( … , medcol = "red", boxlty = 0, whisklty = 1, staplelwd = 4, outpch = 8, outcex = 3)
    

    This leads to the following boxplot:

    enter image description here

提交回复
热议问题