s-news
[Top] [All Lists]

SUMMARY: trellis graphics

To: s-news@lists.biostat.wustl.edu
Subject: SUMMARY: trellis graphics
From: Greg Tarpinian <sasprog474@yahoo.com>
Date: Fri, 23 Jul 2004 13:13:56 -0700 (PDT)
Here is a summary of the replies I received, thanks
to everyone for taking the time to help out:


----------------------------
As far as I've been able to figure out, the col=
options are the same
for reg. graphics and trellis graphics.  Typing
"show.col()" at the
command line will open a graph sheet that shows all
available colors.  

mlk
----------------------------
I'll tackle number 3.


I borrowed the following from John Fox's book An R and
S-Plus Companion
for Applied Regression, you can use it to test the
settings on the 
device
you
wish to chose--adapting to a trellis device isn't
difficult.

plot(1:25, type="n", main="Device Options",
axes=FALSE, ylab="",
xlab="Setting")
for(i in 1:25){
        points(i, i, col=i, pch=i)
        segments(i, 0, i, i, col=i, lty=i, lwd=3)}
axis(1, at=1:25)
box()

wmf.graph("c:/plotSettings.wmf")
plot(1:25, type="n", main="Device Options",
axes=FALSE, ylab="",
xlab="Setting")
for(i in 1:25){
        points(i, i, col=i, pch=i)
        segments(i, 0, i, i, col=i, lty=i, lwd=3)}
axis(1, at=1:25)
box()

dev.off()


Here is an example of setting four colors in the
palate (black, red, 
blue
and white) and using in 
traditional graphics:

 
wmf.graph(paste("c:/data_mirror/stat/enbrel/g_eroyr1_",
i, ".wmf",
sep=""),
                    colormap=matrix(c(0,0,0,0, 0, 1,
1, 0, 0, 1, 1, 1),
ncol=3, byrow=TRUE),
                    line.colors=c(1,2,3),
                    text.colors=c(1,1), 
                    polygon.colors=c(2,3), 
                    image.colors=c(2,3), 
                    background.color=c(4,4))

Here is an example of using a slightly different
technique to load the
colors I want
on a trellis device:

trellis.device(postscript, 
               file = paste(outgraph,
"g_ind_hgb_162.ps", sep=""),
               horizontal=T,
               colors=ps.colors.rgb[c("black",
"LightGray", "red", 
"gold",
"LawnGreen",
                                      "SlateBlue",
"orange",
"LightSeaGreen"),],
               background=-1) 

You can see all preset colors for the postscript
device in the 
following
manner.

> ps.colors.rgb
numeric matrix: 738 rows, 3 columns. 
                      Red     Green      Blue 
           snow 1.0000000 0.9803922 0.9803922
    ghost white 0.9725490 0.9725490 1.0000000
     GhostWhite 0.9725490 0.9725490 1.0000000
    white smoke 0.9607843 0.9607843 0.9607843

Good luck,

--Matt
------------------------------
Greg,

For first question, I store my graphics as windows
metafiles (.wmf) and 
import into Word or PowerPoint.  I've not had
resolutions issues.

For other two questions, I know I've done something
along the lines, 
but at moment not sure what I did.  I hope others who
are up to date will 
give some help.

Jim


                
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

<Prev in Thread] Current Thread [Next in Thread>
  • SUMMARY: trellis graphics, Greg Tarpinian <=