An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110503/d4cb034b/attachment.pl>
Axis trouble
4 messages · swaraj basu, Patrick Breheny, David Winsemius
The expression
0:g_range[2]
is not meaningful. The : operator is for integers, while your data is continuous. Likely, you want something along the lines of
axis(2, las=1, at=pretty(vecAVG))
_______________________
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of swaraj basu
Sent: Tuesday, May 03, 2011 9:13 AM
To: r-help at r-project.org
Subject: [R] Axis trouble
Hello Everyone,
I am having problem in defining specific axis for
plotting a vactor.
vecAVG <- c(0.2, 0.4, 0.6, 0.2, 0.4)
names(vecAVG)<-c("brain","heart","kidney","lung","blood")
par(mar=c(12,4.1,4.1, 2.1))
plot(sort(vecAVG,decreasing=TRUE),type="p",pch=19,col="darkslateblue",axes=FALSE,ann=FALSE)
g_range<-range(vecAVG)
axis(1,at=0:length(vecAVG),lab=names(vecAVG),las=2)
axis(2, las=1, at=0:g_range[2])
After these commands I am getting the graph but it does not have any Y axis.
I know I am making a silly mistake somewhere. Can someone please guide me.
______________________________________________
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.
On May 3, 2011, at 6:12 AM, swaraj basu wrote:
Hello Everyone,
I am having problem in defining specific
axis for
plotting a vactor.
vecAVG <- c(0.2, 0.4, 0.6, 0.2, 0.4)
names(vecAVG)<-c("brain","heart","kidney","lung","blood")
par(mar=c(12,4.1,4.1, 2.1))
plot
(sort
(vecAVG
,decreasing
=TRUE),type="p",pch=19,col="darkslateblue",axes=FALSE,ann=FALSE)
g_range<-range(vecAVG)
axis(1,at=0:length(vecAVG),lab=names(vecAVG),las=2)
axis(2, las=1, at=0:g_range[2])
After these commands I am getting the graph but it does not have any
Y axis.
I know I am making a silly mistake somewhere. Can someone please
guide me.
I am guessing the you come from a different programming planet where vectors go from 0 upwards. This is the problem: at=0:length(vecAVG) Try: at=1:length(vecAVG) And you should post your error messages with your code.
David Winsemius, MD Heritage Laboratories West Hartford, CT
On May 3, 2011, at 7:10 AM, David Winsemius wrote:
On May 3, 2011, at 6:12 AM, swaraj basu wrote:
Hello Everyone,
I am having problem in defining specific
axis for
plotting a vactor.
vecAVG <- c(0.2, 0.4, 0.6, 0.2, 0.4)
names(vecAVG)<-c("brain","heart","kidney","lung","blood")
par(mar=c(12,4.1,4.1, 2.1))
plot
(sort
(vecAVG
,decreasing
=TRUE),type="p",pch=19,col="darkslateblue",axes=FALSE,ann=FALSE)
g_range<-range(vecAVG)
axis(1,at=0:length(vecAVG),lab=names(vecAVG),las=2)
axis(2, las=1, at=0:g_range[2])
After these commands I am getting the graph but it does not have
any Y axis.
I know I am making a silly mistake somewhere. Can someone please
guide me.
I am guessing the you come from a different programming planet where vectors go from 0 upwards. This is the problem: at=0:length(vecAVG) Try: at=1:length(vecAVG) And you should post your error messages with your code.
And the simple fix to the second problem is just: axis(2, las=1)
-- David Winsemius, MD Heritage Laboratories West Hartford, CT
______________________________________________ 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.
David Winsemius, MD Heritage Laboratories West Hartford, CT