Hi, i am working on bar plot but i need to generate y axis for horizontal bar plot. In the attached diagram x-axis is there with scale 0 to 12 but i need y axis. How can i implement it? http://r.789695.n4.nabble.com/file/n4630478/barplot2.jpg Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-create-axis-y-axis-for-horizontal-bar-plot-tp4630478.html Sent from the R help mailing list archive at Nabble.com.
-----Original Message-----
From: Manish Gupta
Sent: Friday, May 18, 2012 2:52 AM
To: r-help at r-project.org
Subject: [R] How to create axis y axis for horizontal bar plot?
Hi,
i am working on bar plot but i need to generate y axis for horizontal bar
plot. In the attached diagram x-axis is there with scale 0 to 12 but i need
y axis. How can i implement it?
http://r.789695.n4.nabble.com/file/n4630478/barplot2.jpg
Thanks
Try:
gears = c(3,4,5)
b = barplot(gears, horiz=TRUE)
axis(2, at=b, labels=c('three','four','five'))
Rob
------------------------------------------
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965
Chris Campbell
2012-May-18 13:45 UTC
[R] How to create axis y axis for horizontal bar plot?
# Hi Manish, try this
# locate the y axis central positions
barObj <- plot(factor(mtcars$gear, labels = paste(3:5, "Gears")),
horiz = TRUE)
# create the plot
plot(factor(mtcars$gear, labels = paste(3:5, "Gears")), horiz = TRUE)
# add axes
axis(side = 2, at = c(barObj), labels = FALSE)
Chris Campbell
Tel. +44 (0) 1249 705 450
http://www.mango-solutions.com
Mango Solutions
2 Methuen Park
Chippenham
Wiltshire
SN14 OGB
UK
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Manish Gupta
Sent: 18 May 2012 08:53
To: r-help at r-project.org
Subject: [R] How to create axis y axis for horizontal bar plot?
Hi,
i am working on bar plot but i need to generate y axis for horizontal bar plot.
In the attached diagram x-axis is there with scale 0 to 12 but i need y axis.
How can i implement it?
http://r.789695.n4.nabble.com/file/n4630478/barplot2.jpg
Thanks
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-create-axis-y-axis-for-horizontal-bar-plot-tp4630478.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
LEGAL NOTICE
This message is intended for the use o...{{dropped:10}}
Thanks! It works but how can i remove x axis? Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-create-axis-y-axis-for-horizontal-bar-plot-tp4630478p4631045.html Sent from the R help mailing list archive at Nabble.com.