I am trying to get a stripchart with their medians in the horizontal. In the stripchart
function there is a parameter that allows you to do that ( vertical=F
) but I cannot find a similar parameter to draw the medians in the horizontal using points
.
My example:
median <- tapply(mtcars$mpg, mtcars$gear, median)
stripchart(mpg ~ gear,
data = mtcars,
main = "title",
xlab = "x axis",
ylab = "y axis",
col = c('green', 'blue', 'purple'),
pch = 16,
cex = 0.8,
method = 'jitter',
vertical = F)
points(x=c(median), pch="--", cex=5)
This is what I am getting right now:
This is what I would like to have (but instead of in the vertical way, I want in the horizontal way). [Same code than before but using vertical = F
].
Does anyone know how can I do it?
Thanks very much in advance
Regards
Thanks to this post , I found the solution!
stripchart(mpg ~ gear,
data = mtcars,
main = "title",
xlab = "x axis",
ylab = "y axis",
col = c('green', 'blue', 'purple'),
pch = 16,
cex = 0.8,
method = 'jitter',
vertical = F)
points(c(median), order(median), pch="|", cex=2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.