apple=c(1,2,3,4,5) banana=c(5,4,3,2,1) watermelon=c(4,5,6,7,8) boxplot(apple, banana, watermelon)
If I were to plot this, the x-axis of the boxplot is labeled as 1, 2 and 3. How can I change those to "apple", "banana", and "watermelon," respectively? xlab=
labels the entire axis, but not the individual boxplots. Which command/option should I use?
If you read the help file for ?boxplot
, you'll see there is a names=
parameter.
boxplot(apple, banana, watermelon, names=c("apple","banana","watermelon"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With