[Rd] a bug of function plot (PR#4405)
Stefano Iacus
jago at mclink.it
Sat Oct 4 12:30:34 MEST 2003
On Sabato, ott 4, 2003, at 04:56 Europe/Rome, xzhao at stat.wvu.edu wrote:
> Full_Name: Ximing Zhao
> Version: R 1.7.1
> OS: MacOs X
> Submission from: (NULL) (64.136.27.51)
>
>
> When I used function plot in R 1.7.1, I found two bugs.
> My whole function is this:
> *****************
> drawexp<-function(X,x,c,b){
> exp<-function28(X,x,c,b)
> if(max(exp)>=max(dexp(x,rate=1))){
> plot(x,exp, type="l",main= paste("Exponential ,n=",length(X),"
> c=",round(c,2),"b=",b),sub="X=exp(rate=1)")
> lines(x,dexp(x,rate=1),col="red",type="l")
> lines(density(X,width="SJ-dpi",n=1000,from=0.1,to=4),lty=2,col="blue")
> }
> else{
> plot(x,dexp(x,rate=1),col="red",type="l",main= paste("Exponential
> ,n=",length(X)," c=",round(c,2),"b=",b),sub="X=exp(rate=1)")
> lines(x,exp, type="l")
> lines(density(X,width="SJ-dpi",n=1000,from=0.1,to=4),lty=2,col="blue")
> }
> text(3,0.35,"-- theoretical",col="red",adj=c(0,0))
> text(3,0.3,"-- moment type", adj=c(0,0))
> text(3,0.25, "-- Kernel type", col="blue", adj=c(0,0))
> }
>
> function28<-function(X,x,c,b){
> est<-function(X,x,alfa){
> fx<-(1/gamma(alfa))*((alfa-1)/x)*(alfa*X/x)^(alfa-1)*exp(-alfa*X/x)
> fx
> }
> n<-length(X)
> result<-colSums(sapply(x,function(x){est(X,x,alfa=(n^c)*log(n)^b)}))/
> length(X)
> result
> }
>
> X1<-rexp(100)
>
> x1<-seq(0.1,4,length=100)
>
> Run the function like this:
>
> drawexp(X1,x1,0,0.5)
>
> ***************
>
> For
> "lines(density(X,width="SJ-
> dpi",n=1000,from=0.1,to=4),lty=2,col="blue")",
> only lty=1 works, lty=2 and others don't work. I tried the function in
> 1.6.2
> before,
> it was alright. So I am positive it's a bug. Please check.
are you referring to which version of R for MacOSX. Till 1.7.1 there
were two versions: darwin/X11 and Carbon port of R both running under
OSX.
In darwin/X11 the quartz device has never worked correctly wrt to lty,
symbol fonts and ISOLatin/MacRoman related display. All of this has
been fixed and many new features has been implemented for the quartz
device int he forthcoming release 1.8.0 of R.
If you were using Carbon R, than probably also using the macintosh()
device. In this case lty was only partly working. In any case this
device is no longer used by any port of R since 1.7.1 is the last
release of Carbon R.
There is now a new darwin port of R which has an Aqua gui. This version
is intended to replace the old Carbon R.
It is called RAqua and you'll find it on CRAN under the bin/macosx dir
_after_ R-1.8.0 is relased.
If you where talking about X11, this lty problems seems not to be
there. Have you also the latest X11 window manager from apple?
In any case, please be more precise on all the parts of your
configurations that are relevant wrt to the claimed bug, otherwise we
cannot be helpful to you and we hardly understand if and where there is
a bug.
stefano
>
> Another thing is, if X11 window for the graph is not big enough, and
> the text,
> like "-- moment type" in the function floats out, then X11 window
> doesn't show
> the text at all. If you use the function in 1.6.2, it will show part
> of it but
> not the characters beyond the graph size. I don't think it's
> reasonable to not
> show anything. So it should be another bug.
>
> I have a few suggestions, please keep the version which has been
> tested for a
> long
> time and with few bugs on the website(for different operating system),
> so
> whenever people need some old good version they can still download
> from CRAN.
> Also, please do not update the version of R in such a hurry way and
> let such
> mistakes happen so easily. If you do update the version and want to
> introduce to
> people, please mark it as "beta" so people will know. I understand
> this is a
> free software and it's pretty hard to manage, but such efforts will be
> greatly
> appreciated.
>
> If you have any question w/ the bugs I described, please email me and
> I'd like
> to
> help.
>
> Thank you very much!
>
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list