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) This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit us at http://www.polarisFT.com
Try: plot(as.numeric(data$Var1),data$Freq,ylim=c(0,700),col="green",type="o",ylab="",xlab="",las=2,lwd=2.5,xaxt="n") A.K. ----- Original Message ----- From: "mohan.radhakrishnan at polarisft.com" <mohan.radhakrishnan at polarisft.com> To: r-help at r-project.org Cc: Sent: Tuesday, September 24, 2013 8:46 AM Subject: [R] Graph is without line 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) This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only.? If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit us at http://www.polarisFT.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.
On 09/24/2013 10:46 PM, mohan.radhakrishnan at 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