Skip to content
Prev 385456 / 398506 Next

plot factors with dots in R

Hello,

The plots that you say give bars (or my equivalent version below) don't 
give bars, what they give are boxplots with just one value and the 
median Q1 and Q3 are all equal.

plot(y ~ factor(x), df, pch = 16)  # boxplot


Is the following what you are looking for?


plot(y ~ as.integer(factor(x)), df, pch = 16, xlab = "x", xaxt = "n")
axis(1, at = as.integer(factor(df$x)), labels = df$x)


Hope this helps,

Rui Barradas


?s 13:16 de 27/08/20, Luigi Marongiu escreveu: