Dear All,
probably a simple enough solution but don;t seem to be able to get my head around it...example based on a publicly available data set: mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv") mylogit <- glm(admit ~ gre + gpa + rank, data = mydata, family = "binomial") library(effects) plot(allEffects(mylogit) ,axes=list(y=list(lab="Prob(xyz)")) ) axes=list(y=list(lab="Prob(xyz)")) changes the y axis labels for all 3 plots... Any thoughts on how I could change the x axis labels to let say 'black' (plot 1), 'white' (plot 2) and 'green' (plot 3) for the 3 respective plots produced? appreciate the help... Andras ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see 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. |
Hi Andras,
I have not used this package before but I did the following steps to arrive at an answer. Hopefully both the answer is what you are looking for and also the steps to understand how you can answer such questions yourself in the future. 1. R is an object-oriented language, but there are several ways in which classes are supported. In particular, methods for some classes don't reside with the class but with extensions to "generic" functions. The 'plot' function is such an example. So the first step is to understand the class returned by the function allEffects. > myObj <- allEffects(mylogit) > class(myObj) # efflist 2. Next look at the documentation for the extensions to 'plot' for an 'efflist' class > ?plot.efflist 3. Search in the help documentation for 'axes' to understand what is going on (they also supply a lot of examples at the end of the help page). A few experiments and the following seems to do what you asked for: > plot(allEffects(mylogit), + axes=list(x=list(gre=list(lab="black"),gpa=list(lab="white"),rank=list(lab="green")), + y=list(lab="Prob(xyz)"))) HTH, Eric On Sat, Nov 11, 2017 at 2:20 AM, Andras Farkas via R-help < [hidden email]> wrote: > Dear All, > > probably a simple enough solution but don;t seem to be able to get my head > around it...example based on a publicly available data set: > > mydata <- read.csv("https://stats.idre.ucla.edu/stat/data/binary.csv") > mylogit <- glm(admit ~ gre + gpa + rank, data = mydata, family = > "binomial") > library(effects) > plot(allEffects(mylogit) > ,axes=list(y=list(lab="Prob(xyz)")) > ) > > axes=list(y=list(lab="Prob(xyz)")) changes the y axis labels for all 3 > plots... Any thoughts on how I could change the x axis labels to let say > 'black' (plot 1), 'white' (plot 2) and 'green' (plot 3) for the 3 > respective plots produced? > > > appreciate the help... > > Andras > > ______________________________________________ > [hidden email] mailing list -- To UNSUBSCRIBE and more, see > 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. [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list -- To UNSUBSCRIBE and more, see 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. |
Free forum by Nabble | Edit this page |