Quantcast

How to create axis y axis for horizontal bar plot?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

How to create axis y axis for horizontal bar plot?

Manish Gupta
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?



Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to create axis y axis for horizontal bar plot?

Robert Baer
-----Original Message-----
From: Manish Gupta
Sent: Friday, May 18, 2012 2:52 AM
To: [hidden email]
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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to create axis y axis for horizontal bar plot?

Chris Campbell
In reply to this post by Manish Gupta
# 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: [hidden email] [mailto:[hidden email]] On Behalf Of Manish Gupta
Sent: 18 May 2012 08:53
To: [hidden email]
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.

______________________________________________
[hidden email] 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}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to create axis y axis for horizontal bar plot?

Manish Gupta
In reply to this post by Robert Baer
Thanks! It works but how can i remove x axis?

Regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: How to create axis y axis for horizontal bar plot?

Sarah Goslee
On Wed, May 23, 2012 at 3:26 AM, Manish Gupta <[hidden email]> wrote:
> Thanks! It works but how can i remove x axis?

I have no idea "what works," except that it may in some way relate to
bar plots, but in general xaxt="n" will remove an x axis. See ?par for
details.

> --
> 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.

Many of us don't use Nabble, and so if you don't include context in
your post we won't have the foggiest idea what you're talking about.

--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] 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.
Loading...