Is there anyway to make the lines in the dispersion command come forward in a plot and allow the fill in the dispersion parameter be transparent so all of the lines I am using to note confidence intervals are shown? ------------------------------------------- Joe King, M.A. Ph.D. Student University of Washington - Seattle 206-913-2912 jp@joepking.com ------------------------------------------- "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt [[alternative HTML version deleted]]
On Oct 30, 2009, at 7:02 AM, Joe King wrote:> Is there anyway to make the lines in the dispersion command come > forward in > a plot and allow the fill in the dispersion parameter be transparent > so all > of the lines I am using to note confidence intervals are shown?Got code?> ------------------------------------------- > > Joe King, M.A. > > Ph.D. Student-- David Winsemius, MD Heritage Laboratories West Hartford, CT
Heres my code: era1 <- seq(1.5,5,.25) plot(era1,yhyp1$pe, xlab="ERA", ylab="Probability of Winning Cy Young",type="l", col="black", lwd=2) dispersion(era1,yhyp1$pe,y1upper,y1lower,type="l", fill="blue",arrow.cap=0.01,intervals=FALSE)#Requres plotrix dispersion(era1,yhyp2$pe,y2upper,y2lower,type="l", fill="lightcyan",arrow.cap=0.01,intervals=FALSE)#Requres plotrix dispersion(era1,yhyp3$pe,y3upper,y3lower,type="l", fill="gray97",arrow.cap=0.01,intervals=FALSE)#Requres plotrix lines(era1,yhyp1$pe,col="black", lwd=5) lines(era1,yhyp2$pe,col="blue", lwd=5) lines(era1,yhyp3$pe,col="red", lwd=5) my raw data is too much to add as I have coefficients from a model run and a lot of code before that but the matricies for the above variables I am trying to plot are> yhyp1$pe[1] 0.91938328 0.88005171 0.82235810 0.74124787 0.63520716 0.51090516 [7] 0.38417025 0.27254070 0.18569395 0.12375682 0.08183003 0.05420338 [13] 0.03619331 0.02446051 0.01677548> yhyp1$upper[,1] up 0.98470376 up 0.96729674 up 0.93342185 up 0.87016432 up 0.77356024 up 0.63337489 up 0.49704477 up 0.39523107 up 0.32380653 up 0.26340188 up 0.21370693 up 0.17113476 up 0.13810301 up 0.11119516 up 0.08930777> yhyp1$lower[,1] low 0.758338075 low 0.704684752 low 0.636448570 low 0.569633622 low 0.485986148 low 0.390656111 low 0.276924551 low 0.169273771 low 0.092501362 low 0.048176412 low 0.023014862 low 0.010788438 low 0.005082446 low 0.002250877 low 0.001063545 Please forgive my poor posting manners. Joe King 206-913-2912 jp at joepking.com "Never throughout history has a man who lived a life of ease left a name worth remembering." --Theodore Roosevelt -----Original Message----- From: David Winsemius [mailto:dwinsemius at comcast.net] Sent: Friday, October 30, 2009 7:15 AM To: Joe King Cc: r-help at r-project.org Subject: Re: [R] opacity under dispersion command under plotrix On Oct 30, 2009, at 7:02 AM, Joe King wrote:> Is there anyway to make the lines in the dispersion command come > forward in > a plot and allow the fill in the dispersion parameter be transparent > so all > of the lines I am using to note confidence intervals are shown?Got code?> ------------------------------------------- > > Joe King, M.A. > > Ph.D. Student-- David Winsemius, MD Heritage Laboratories West Hartford, CT
On Oct 30, 2009, at 3:49 PM, Joe King wrote:> Heres my code: > > era1 <- seq(1.5,5,.25) > plot(era1,yhyp1$pe, xlab="ERA", ylab="Probability of Winning Cy > Young",type="l", col="black", lwd=2)This plots. library(plotrix) # should go here.> dispersion(era1,yhyp1$pe,y1upper,y1lower,type="l", > fill="blue",arrow.cap=0.01,intervals=FALSE)#Requres plotrixThis throws an error even with plotrix loaded.> dispersion(era1,yhyp2$pe,y2upper,y2lower,type="l", > fill="lightcyan",arrow.cap=0.01,intervals=FALSE)#Requres plotrix > dispersion(era1,yhyp3$pe,y3upper,y3lower,type="l", > fill="gray97",arrow.cap=0.01,intervals=FALSE)#Requres plotrixTry using the rgb function to create transparent colors: > rgb(1,0,0,0.3) [1] "#FF00004D"> lines(era1, yhyp1$pe, col="#FF00004D", lwd=5)The above _does_ plot with transparent color, but the below will not without data.> lines(era1,yhyp2$pe,col="blue", lwd=5) > lines(era1,yhyp3$pe,col="red", lwd=5) >After a bunch of cutting and pasting of the yhyp1 data. I still get errors because y1upper and y1lower are not defined (nor their values implied by what you have written.) Learn to use dput and review your code to see what variables are undefined. -- David> my raw data is too much to add as I have coefficients from a model > run and a > lot of code before that but the matricies for the above variables I am > trying to plot are >> yhyp1$pe > [1] 0.91938328 0.88005171 0.82235810 0.74124787 0.63520716 0.51090516 > [7] 0.38417025 0.27254070 0.18569395 0.12375682 0.08183003 0.05420338 > [13] 0.03619331 0.02446051 0.01677548 > >> yhyp1$upper > [,1] > up 0.98470376 > up 0.96729674 > up 0.93342185 > up 0.87016432 > up 0.77356024 > up 0.63337489 > up 0.49704477 > up 0.39523107 > up 0.32380653 > up 0.26340188 > up 0.21370693 > up 0.17113476 > up 0.13810301 > up 0.11119516 > up 0.08930777 > >> yhyp1$lower > [,1] > low 0.758338075 > low 0.704684752 > low 0.636448570 > low 0.569633622 > low 0.485986148 > low 0.390656111 > low 0.276924551 > low 0.169273771 > low 0.092501362 > low 0.048176412 > low 0.023014862 > low 0.010788438 > low 0.005082446 > low 0.002250877 > low 0.001063545 > > Please forgive my poor posting manners. > > Joe King > 206-913-2912 > jp at joepking.com > "Never throughout history has a man who lived a life of ease left a > name > worth remembering." --Theodore Roosevelt > > > -----Original Message----- > From: David Winsemius [mailto:dwinsemius at comcast.net] > Sent: Friday, October 30, 2009 7:15 AM > To: Joe King > Cc: r-help at r-project.org > Subject: Re: [R] opacity under dispersion command under plotrix > > > On Oct 30, 2009, at 7:02 AM, Joe King wrote: > >> Is there anyway to make the lines in the dispersion command come >> forward in >> a plot and allow the fill in the dispersion parameter be transparent >> so all >> of the lines I am using to note confidence intervals are shown? > > Got code? > >> ------------------------------------------- >> >> Joe King, M.A. >> >> Ph.D. Student > > -- > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT
On 10/30/2009 10:02 PM, Joe King wrote:> Is there anyway to make the lines in the dispersion command come forward in > a plot and allow the fill in the dispersion parameter be transparent so all > of the lines I am using to note confidence intervals are shown? >Hi Joe, I have probably missed something, as a call to dispersion with type="l" will just display lines with no fill. I'm not sure exactly what you mean by "come forward", I'm guessing this means "displayed last", so just make the call to dispersion the last one for that plot. Jim