Thankyou for your response. > From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] > Sent: 14 October 2008 12:09 > To: Keith Ponting > Cc: [EMAIL PROTECTED]; r-help@r-project.org > Subject: Re: [R] histogram loses top row with alpha transparency under > Windows > > I *presume* this is the windows() device in a current version of R, but > you failed to tell us almost any of the information requested in the > posting guide. >
Yes, it is the windows() device in R 2.7.1 and also R version 2.8.0 beta (2008-10-07 r46631). I very much appreciate the heroic efforts of you and the other core 'R' folk in answering so many e-mails on the list, and also your frustration with posters who do not supply information, but in my defence I must point out that you appear to have only received my second message on this subject - the first one (Message 18 in R-help Digest, Vol 68, Issue 9, to which Richard Cotton replied) gave (I hope) all the information requested. > If so, you are seeing how Windows GDI copying operations work: if the > region to be copied goes off-window, they clip the region completely. > Your example works in R-devel, and if that survives a few weeks of > testing, I might port the workaround to 2.8.1. (A similar fix in 2.7.1 > patched ended up with undesirable side effects in 2.7.2, so careful > testing is needed.) > > Implementing semi-transparent colours on windows() was hard, and it > would be nice to see some appreciation of the effort involved. Once I had found the clipping work-around the results are exactly what I needed - semi-transparent colours are wonderful!! > > On Fri, 10 Oct 2008, Keith Ponting wrote: > > > Richard.Cotton wrote: > > > >> The rectangles being drawn extend higher than the top of the panel. > > (Your y > >> axis ranges from 0 to 50, but the bars go up to 100.) > >> > > > > Thankyou - I can also make the bars on the lower panels vanish by > > tinkering with ylim. > > > >> In the top row of plots, depending upon the shape of your device > > window, the > >> bars can extend beyond the range of the device window. For some > > reason, > >> (take a look in panel.rect), when you specify alpha less than 1, this > >> prevents the bar being drawn. > > > > The problem lies deeper. I can demonstrate the same effect with raw > > grid calls (but cannot find a way into "grid.draw" to see what is > going on): > > > > cols <- rainbow(2,alpha=0.5) > > library(grid) > > grid.newpage() > > pushViewport(plotViewport(c(5,4,2,2))) > > # draw viewport limits: > > grid.rect() > > # VISIBLE: small projection outside viewport, transparent fill and > > edge > > grid.rect(gp=gpar(fill=cols[2],col=cols[1]),height=unit(1.1,"npc"),wid > > th > > =unit(0.18,"npc"),x=0.1) > > # VISIBLE: small projection outside viewport, standard colours fill > > and edge > > > grid.rect(gp=gpar(fill=2,col=3),height=unit(1.1,"npc"),width=unit(0.18," > > npc"),x=0.3) > > # INVISIBLE: larger projection outside viewport, transparent colours > > fill and edge > > grid.rect(gp=gpar(fill=cols[2],col=cols[1]),height=unit(1.5,"npc"),wid > > th > > =unit(0.18,"npc"),x=0.5) > > # VISIBLE: larger projection outside viewport, standard colours fill > > and edge > > > grid.rect(gp=gpar(fill=2,col=3),height=unit(1.5,"npc"),width=unit(0.18," > > npc"),x=0.7) > > # MIXED: larger projection outside viewport, standard colour edge > > visible, transparent fill not > > grid.rect(gp=gpar(fill=cols[2],col=3),height=unit(1.5,"npc"),width=uni > > t( > > 0.18,"npc"),x=0.9) > > > > I can also show the same effect using standard graphics calls: > > > > par(xpd=NA) > > plot(c(1,2)) > > rect(1.01,1,1.19,2.2,border=cols[1],col=cols[2]) > > rect(1.21,1,1.39,2.2,border=3,col=2) > > rect(1.41,1,1.59,4,border=cols[1],col=cols[2]) > > rect(1.61,1,1.79,4,border=3,col=2) > > rect(1.81,1,1.99,4,border=3,col=cols[2]) > > > > Both of these examples have missing alpha transparency colours under > > Windows but produce the expected filled rectangles under Linux. > > > >> > >> You need to add type="count" to the call to histogram, or rescale the > > bar > >> heights. > > > > My post was a rather simplified example - I am actually trying to make > > visible a "small" distribution on the skirt of a large one, which > > means that scaling the bar heights is not sufficient. I have worked > > around the problem by modifying panel.histogram to _clip_ the bar > heights. > > > > Keith > > > > Keith Ponting > > Aurix Ltd, Malvern WR14 3SZ UK > > > > ______________________________________________ > > 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. > > > > -- > Brian D. Ripley, [EMAIL PROTECTED] > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 Keith Ponting Aurix Ltd, Malvern WR14 3SZ UK ______________________________________________ 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.