'Boxplot data too squeezed: R
I am using R for a school project but I'm new at it. I am testing the impact that the degree of embeddedness of codetermination policies (as measured by the MB-ix index) has on revenue per employee. When I graph a boxplot, the boxes are very squeezed together and it is hard to interpret. I think this may have to do with a few outliers. How can I fix this?
Solution 1:[1]
It is definitely the outliers. One possibility would be to remove them and add a note providing their values to the plot. Another possibility is to use a log scale on the y-axis. Here is an example using data that is included with R:
data(iris)
example <- iris[, c(5, 3)]
oldp <- par(mfrow=c(1, 2))
# Modify Petal.Length to create outliers
PL <- 10^example$Petal.Length
boxplot(PL~Species, example, ylab="Petal Length")
boxplot(PL~Species, example, log="y", ylab="Petal Length (log scale)")
par(oldp)
You do not need to modify your data.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dcarlson |

