Um texto embutido e sem conjunto de caracteres especificado foi limpo... Nome: n?o dispon?vel Url: <https://stat.ethz.ch/pipermail/r-help/attachments/20120223/76a7e14a/attachment.pl>
why is generating the same graph???
4 messages · Vanúcia Schumacher, David Winsemius, PIKAL Petr +1 more
On Feb 22, 2012, at 7:08 PM, Van?cia Schumacher wrote:
Hi,
why my script iss always generating the same graph?when I change the
parameters and the name of text file?
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()
Color me puzzled: You are complaining that the same graph is produced when you give it the same data?
David Winsemius, MD West Hartford, CT
Hi
Hi,
why my script iss always generating the same graph?when I change the
parameters and the name of text file?
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()
I am rather puzzled. Hist will always plot a histogram if you give suitable data to it. You do not show what x is. And I believe that if you do hist(dados[[1]], seq(20, 35, 0.5), prob=TRUE, xlab="Bla bla (m/s)",ylab="xxxxxxxxxxx", main="150 m") curve(dweibull(x, shape=0.614, scale=2.435), 0,18,add=T, col='blue') You get some changes in your graph. If not something is wrong with hist or curve. You maybe redefined those functions somehow. Regards Petr
Best Regards [[alternative HTML version deleted]]
______________________________________________ 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.
-----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Van?cia Schumacher Sent: 23 February 2012 00:08 To: r-help at 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}}