[R] why is generating the same graph???

Petr PIKAL petr.pikal at precheza.cz
Thu Feb 23 08:01:32 CET 2012


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.



More information about the R-help mailing list