[R] identify() and postscript output

2009-03-05 Thread Michael Friendly
In the following, I'm fitting a logistic regression model, and using 
car:::influencePlot.  When I run the latter with
output to the screen, it calls identify() that lets me label 
observations with large CookD.


However, if I use postscript() to get .eps output, identify() seems not 
to be called at all.  If instead, I
use dev.copy2eps() after getting output to the screen, the point labels 
do not appear in the resulting .eps

graph.  Why?  Is there a workaround?

library(vcd)
data(Arthritis)
# define Better
Arthritis$Better <- Arthritis$Improved > 'None'
arth.mod1 <- glm(Better ~ Age + Sex + Treatment , data=Arthritis, 
family='binomial')

library(car)
# influence plot
#postscript(file="arthritis-diag2.eps", paper="special", height=6, 
width=6, onefile=TRUE, horizontal=FALSE)

influencePlot(arth.mod1, main="Arthritis data: influencePlot")
#dev.off()

-Michael

--
Michael Friendly Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
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.


Re: [R] identify() and postscript output

2009-03-05 Thread David Winsemius

From the help page:
"Details
identify is a generic function, and only the default method is  
described here.


identify is only supported on screen devices such as X11, windows and  
quartz. On other devices the call will do nothing."


Why not collect the specifics of the identified points and then replot  
to your chosen output device perhaps with a different color or a text  
label? identify should return a value that can be used for that  
purpose. The help page provides an example that should be modifiable  
for that purpose.


--

David Winsemius

On Mar 5, 2009, at 9:18 AM, Michael Friendly wrote:

In the following, I'm fitting a logistic regression model, and using  
car:::influencePlot.  When I run the latter with
output to the screen, it calls identify() that lets me label  
observations with large CookD.


However, if I use postscript() to get .eps output, identify() seems  
not to be called at all.  If instead, I
use dev.copy2eps() after getting output to the screen, the point  
labels do not appear in the resulting .eps

graph.  Why?  Is there a workaround?

library(vcd)
data(Arthritis)
# define Better
Arthritis$Better <- Arthritis$Improved > 'None'
arth.mod1 <- glm(Better ~ Age + Sex + Treatment , data=Arthritis,  
family='binomial')

library(car)
# influence plot
#postscript(file="arthritis-diag2.eps", paper="special", height=6,  
width=6, onefile=TRUE, horizontal=FALSE)

influencePlot(arth.mod1, main="Arthritis data: influencePlot")
#dev.off()

-Michael

--
Michael Friendly Email: friendly AT yorku DOT ca Professor,  
Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

__
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.


__
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.


Re: [R] identify() and postscript output

2009-03-05 Thread Michael Friendly

Prof Brian Ripley wrote:
If instead, I use dev.copy2eps() after getting output to the screen, 
the point labels do not appear in the resulting .eps graph. Why?  Is 
there a workaround?


I don't think that is true:

plot(1:10)
identify(1:10)
## Click near points 6 and 7
dev.copy2eps("test.eps")

and the points I selected are marked in test.eps.

Since Michael ignored the posting guide (again) we have no idea of 
what version etc of R he used: I checked on 2.8.1 on Linux and also on 
Mac OS. This was once a bug, fixed a while ago.
My bad. Thanks for Ripleying me. I'm using Win XP, R 2.8.1 with packages 
shown under sessionInfo() below.


> plot(1:10)
> identify(1:10)

> ## Click near points 6 and 7
> dev.copy2eps("test.eps")
Error in device(...) : unknown family 'test.eps'

I get output on WinXP by specifying file=
> dev.copy2eps(file="test.eps")
windows
 2

But still no joy -- test.eps *does not* contain the point labels (I 
clicked on 7 & 8).  It's not a viewer problem --

I checked with gv on Linux.  Perhaps that bug wasn't fixed on WinXP?
I also attach a .png screen shot of the R graphics window.

> sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


attached base packages:
[1] grid  stats graphics  grDevices utils datasets  
methods   base


other attached packages:
[1] gnm_0.9-8vcdExtra_0.3-4   vcd_1.2-2colorspace_1.0-0 
MASS_7.2-45  nnet_7.2-45
[7] lattice_0.17-20  car_1.2-12 


loaded via a namespace (and not attached):
[1] qvcalc_0.8-4 tools_2.8.1
>


--
Michael Friendly Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA



test.eps
Description: PostScript document
<>__
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.