Questions tagged [boxplot]

Boxplot is a form of displaying cardinally scaled data displaying robust summary statistics as graphical elements.

A boxplot (or a box-and-whisker plot) is a mean of displaying cardinally scaled data. The graphic displays robust summary statistics of a given dataset. These include for the box: the median, the lower quartile and the upper quartile. The enclosed whiskers are not commonly defined and may display some figure tied to the inter quartile range (e.g. IQR x 1.5) or the maxima/minima. Sometimes outliers are displayed as well.

Boxplots may easily be created by most statistical packages such as:

boxplot(rnorm(100)) #For R
boxplot(randn(100)) %For Matlab
graph box variable  'For Stata
boxplot(data)       #For matplotlib (python)
boxplot(dataframe)  #For seaborn (python)

Link:

3351 questions
1
vote
1 answer

How to prepare data object for R boxplot by var and bin?

I want to plot groups of boxplots, as the following plot shows: Data generation bp_data = list( set = c(1,1,2,2,3,3,4,4), var = rep(c("red", "green"), 4), val = t(matrix(runif(800, 1, 50)+seq(1,40,length=800 ), 100, 8)) # fake…
agoldev
  • 2,078
  • 3
  • 23
  • 38
1
vote
1 answer

Empty boxplot in R

I am trying to draw boxplots with the following code. When I run it, I get 2 empty boxes, with no plot. It must be something minor, but I can't seem to fix it. Can someone please help. Sorry, just added the library as 1st line of code. Here's my…
Soly
  • 155
  • 1
  • 2
  • 9
1
vote
1 answer

R ggplot boxplot Error: Aesthetics must be either length 1 or the same as the data (100): x, y

I am trying to create a boxplot with the data frame grades_software, software as a discrete variable X (R/SPSS) and grades as a continuous variable Y. I used the following code: library(ggplot2) ggplot(grades_software, aes(software,…
1
vote
1 answer

R boxplot - how to normalize against given high and low limits instead of min and max

I have several measurements, which need to be presented in same boxplot chart, despite having completely different scales. Each group (=measurement type) has their own specific high and low acceptance limits. The data should be normalized in R so…
GaryHill
  • 85
  • 10
1
vote
1 answer

Boxplot legend as axis title

How do I add the legends of the boxplot at the bottom so that they show up as a secondary axis text line above the "Follow-up 1", "Follow-up 2" etc. line?
Mac
  • 111
  • 1
  • 2
  • 10
1
vote
1 answer

R Boxplot two rows at x-axis

I try to draw a boxplot with two rows of numbers on the x-axis. Where #1 is the default and I want it to be like #2. Is it possible to add another row and give it unique ticks and intervalls? So far I tried the axis() function and was trying to…
nowi
  • 53
  • 6
1
vote
1 answer

Order Y-axis ggplot boxplot based on dataframe column

I made a boxplot figure with ggplot, but I want to change the order of the y-axis based on the order of a column in a different dataframe that I created using summary statistics. Here's the script. Below the script is a description of my desired…
SHW
  • 461
  • 7
  • 26
1
vote
1 answer

Struggling to add legend to box plot in R

I am relatively new user in R - and I seem stuck on what should be fairly easy, I am just not finding the problem in my code set-up. I am trying to create a legend on a simply box plot but I cannot get it to line up correctly, without overlaying…
A.Douglas
  • 11
  • 1
  • 2
1
vote
1 answer

Changing whisker length of multiple boxplot in R

I have a dataframe of 10 variables and I plotted it in two columns. But ggplot defines whiskers as 5th and 95th perecentile. I want whisker lengths as Q1 - 1.5*IQR / Q3 + 1.5*IQR for each of these plots and outliers as usual. A similar question has…
Rajan
  • 453
  • 4
  • 22
1
vote
1 answer

How to change the width of the boxplot frame in R

I am trying to change the thickness of the border containing the boxplot figure. Is there a way to do this in R? Attached is the image with an arrow pointing to the border that I am talking about whose thickness I would like to change illustration…
sal_x_sal
  • 75
  • 1
  • 2
  • 7
1
vote
1 answer

R: Boxplot how to formulate data in effective way

The data I'm using is > head(df2) Results Capacity Power LDI LDE LB PDC D E1 E2 E3 E4 E5 E6 E7 E8 E9 1 DCNoV2GYesDC C1 PG11 LDI0 LDE0 LB0.045 PDC0 D10 30 NA 20 3 1 5 NA NA NA 20 2 DCNoV2GYesDC C0.95 PG11 LDI0 LDE2…
ima
  • 155
  • 12
1
vote
0 answers

Arranging boxplot in ggplot

I have a dataframe of 10 variables and I want boxplot of each of the variables arranged in two columns. Range of each variable is different, so I want different x axis of each one them below the box plot. Currently I tried this but unable to place…
Rajan
  • 453
  • 4
  • 22
1
vote
1 answer

Add sample size to a panel figure of boxplots

I am trying to add sample size to boxplots (preferably at the top or bottom of them) that are grouped by two levels. I used the facet_grid() function to produce a panel plot. I then tried to use the annotate() function to add the sample sizes,…
AMaldonado
  • 11
  • 1
  • 1
  • 3
1
vote
1 answer

R boxplot; center the axis labels under the tick marks

I plotted a dataframe (16700 obs. of 6 variables) using the following code: labels <–c("X2137_Fe20","X2137_FeXS","vtc1_Fe20", "vtc1_FeXS","VTC1c_Fe20","VTC1c_FeXS") #labels x axis [1]col <- c("chartreuse3", "chocolate2", "chartreuse3", "chocolate2",…
Subrix
  • 31
  • 4
1
vote
0 answers

Boxplot over multiple columns within loop

I would like to make boxplots of the following: Example data: > head(df2) Results Capacity Power LDI LDE LB PDC D 1 2 3 4 5 6 7 8 9 1 ImpactDCNoV2GYesDC 1 PG11 LDI6 LDE0 LB0.045 PDC0 D10 1 NA NA NA NA NA…
ima
  • 155
  • 12
1 2 3
99
100