> -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of VanĂșcia Schumacher > Sent: 23 February 2012 00:08 > To: r-help@r-project.org > Subject: [R] why is generating the same graph??? > > > Hi, > why my script iss always generating the same graph?when I > change the parameters and the name of text file?
The usual - in fact probably the only - explanation for the same graph is that the same data set is plotted. This can happen by mistake for lots of reasons, all associated with the operator. Check that: - you have no error messages on file reading. if read.table fails, the initial data set will not be replaced, and R will plot the data set by that name. - your script is actually plotting the data set you are reading; it is surprisingly easy to get names wrong by a character and not notice - that you are reading the right file - that the files you are reading contain different data - that the differences are in column 1 of the data set and not in another column - if you're plotting inside a function, check that the data plotted has the name of the argument and not the name of an object somewhere else in your workspace (This happens often when testing scripts; if we say f<-function(x) plot(y) and then run f using, say, f(z), the function will plot y if it exists in the parent environment for the function. It's not unusual to have created a temporary y (or whatever) to test the code... S > library(MASS) > dados<-read.table("inverno.txt",header=FALSE) > vento50<-fitdistr(dados[[1]],densfun="weibull") > png(filename="invernoRG.png",width=800,height=600) > hist(dados[[1]], seq(0, 18, 0.5), prob=TRUE, xlab="Velocidade > (m/s)",ylab="Densidade", main="50 m") curve(dweibull(x, > shape=0.614, scale=2.435), 0,18,add=T, col='red') > dev.off() > > Best Regards > ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ 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.