On 09/24/2013 10:46 PM, mohan.radhakrish...@polarisft.com wrote:
Hi,
Sometimes I get a graph like the attached one. The data type could
have something to do with it. This graph does not use the color and does
not draw
a line. Earlier I used to convert the factors in the data frame to another
data type and drew the correct graphs.
Any idea why this happens ?
Thanks,
Mohan
Var1 Freq
1 10.1.17.10 205
2 10.1.17.15 216
3 10.1.17.17 79
4 10.1.17.23 76
5 10.1.17.24 209
6 10.1.17.5 244
7 10.1.17.6 178
8 10.1.17.7 165
9 10.1.17.8 146
#prints factor
print(class(data$Var1))
plot(data$Var1,data$Freq,ylim=c(0,700),col="green",type="o",ylab="",xlab="",las=2,lwd=2.5,xaxt="n")
title("Estimation of concurrent connections",cex.main=3)
library(plotrix)
staxlab(at=data$Var1,
labels=as.character(data$Var1),nlines=3,srt=90)
Hi Mohan,
If you pass a factor as the "x" value to plot, it assumes that the
values of the factor are nominal or at best ordinal and does not try to
connect them into a metric scale. You can get a "line" with:
plot(as.numeric(data$Var1),data$Freq,ylim=c(0,700),col="green",type="o",
ylab="",xlab="",las=2,lwd=2.5,xaxt="n")
...
but think carefully about whether this means anything sensible.
Jim
______________________________________________
R-help@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.