Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Increase the thickness of the box lines in an R boxplot?

Tags:

plot

r

boxplot

How can I increase the thickness of the lines that outline "box" part of a boxplot using either the base R plot or boxplot function? That is, how do I thicken the lines of the box that defines the quantiles.

For a plot like this:

boxplot(rnorm(100,50,10), horizontal = TRUE, notch = TRUE)

I'm guessing I need to include a pars = statement like

boxplot(rnorm(100,50,10), horizontal = TRUE, notch = TRUE, pars = ...)

EDIT: My guess regarding the use of pars = comes from a first glance at the documentation for boxplot which indicates that pars = can call "a list of (potentially many) more graphical parameters, e.g., boxwex or outpch; these are passed to bxp (if plot is true)..."

like image 882
N Brouwer Avatar asked Sep 18 '12 22:09

N Brouwer


People also ask

How do you make lines thicker in R?

To set plot line width/thickness in R, call plot() function and along with the data to be plot, pass required thickness/line-width value for the “lwd” parameter.

How do I make my lines thicker in ggplot2?

To change line width, just add argument size=2 to geom_line().

How do I increase the size of a boxplot in R?

When we create a boxplot for a column of an R data frame that contains outlying values, the points for those values are smaller in size by default. If we want to increase the size for those outlying points then outlier. size argument can be used inside geom_boxplot function of ggplto2 package.

Which argument should I use and in geom_boxplot () to dictate the width of the lines in my graph?

We can do this by using lwd argument of geom_boxplot function of ggplto2 package.


2 Answers

See the boxlwd parameter as discussed in ?bxp (linked to from ?boxplot). E.g.

boxplot(rnorm(100,50,10), horizontal = TRUE, notch = TRUE, boxlwd = 4)
like image 110
Gavin Simpson Avatar answered Nov 07 '22 11:11

Gavin Simpson


Are you talking about the rectangle that surrounds the plot area? If so, then this can follow you plot call:

 box(lwd=5)
like image 21
IRTFM Avatar answered Nov 07 '22 13:11

IRTFM