r - Change y-axis side when plotting factors -
i have following plot
k.factor<-factor(sample(1:5, 100, replace = t)) s.factor<-factor(sample(c("a", "b", "c"), 100, replace = t)) plot(k.factor, s.factor)
i remove left y-axis (a, b, c) , plot information legend. how can suppress yaxis? probability axis displayed left y axis (instead of right y axis now)? how can flip this?
please base r answers only
if don't mind using ggplot2
this:
library(ggplot2) ggplot(data.frame(k.factor, s.factor), aes(x = k.factor, fill = s.factor)) + geom_bar(position="fill")
Comments
Post a Comment