I have a datset and am trying to have a plot with probability. My codes go like this:
vp <- table(raising_vowels$realization, raising_vowels$pattern)
vp
Then, I tried to have a barplot via:
barplot(prop.table(vp, 2), main='Convergence affected by pattern',
xlab='Pattern', ylab='Convergence Probability')
This gave me an image with no legend.
I want a legend outside the plot. I tried this code:
barplot(prop.table(vp, 2), main='Convergence affected by pattern',
xlab='Pattern', ylab='Convergence Probability', legend("right", inset=.05,
title="Realization", c("CA","MA"),horiz=TRUE)))
but it did not work. Q: How can I have the legend outside the plot? I tried some websites but could not get a different result. There could be missing packages.