biii m@iii@g oii de@@ey@ws
2021-Sep-22 14:21 UTC
[R] Trying to Learn Details of Grid Graphics, Help Page Errors
Hello, I'm trying to learn the details of grid graphics. Specifically, I'm trying to create a check that will give a warning or error if text goes outside of the visible plot area. (See https://github.com/tidyverse/ggplot2/issues/3282 for an example of what I mean.) In my digging, I think that the right way to do this will be to add either a drawDetails, preDrawDetails, or postDrawDetails method for the "text" class. My questions are: Is that the right way to do it or should I be looking elsewhere? Or, is there already a way to do this? As I was digging in and trying to learn how to do it, I tried to follow some of the examples from the help page for drawDetails (?drawDetails). But, the suggested functions to review do not exist. Specifically, I wanted to look at grid:::preDrawDetails.frame mentioned in the second paragraph of the Details section of the help page, and it doesn't exist. grid:::drawDetails.xaxis and grid:::postDrawDetails.frame also do not exist (mentioned in the next two paragraphs). I would try to make patch, but there is no preDrawDetails or postDrawDetails method in grid that has any content. For drawDetails, there are many choices, and since I'm learning, I'm not sure which would be the best to use as an example. Thanks, Bill [[alternative HTML version deleted]]
Paul Murrell
2021-Sep-22 20:49 UTC
[R] Trying to Learn Details of Grid Graphics, Help Page Errors
Hi The first place you should probably start (given where you are right now) is this R Journal article ... https://journal.r-project.org/archive/2013/RJ-2013-035/RJ-2013-035.pdf In brief, the drawDetails() function has been (almost entirely) superceded by the makeContent() function. The best overall reference is probably the "R Graphics" book (3rd edition, chapts 6, 7, & 8). Unfortunately, because the first edition came out in 2005, that is an Olde Worlde pay-for-a-print-version book (and probably will be until something stupid like 50 years after I have gone). Or maybe you are lucky and work for a first-world university that has purchased access to an electronic version. Thanks for pointing out the problems with the drawDetails() help page; I will need to fix that. Paul On 9/23/2021 2:21 AM, bill at denney.ws wrote:> Hello, > > > > I'm trying to learn the details of grid graphics. Specifically, I'm trying > to create a check that will give a warning or error if text goes outside of > the visible plot area. (See > https://github.com/tidyverse/ggplot2/issues/3282 > <https://github.com/tidyverse/ggplot2/issues/3282> > for an example of what I > mean.) > > > > In my digging, I think that the right way to do this will be to add either a > drawDetails, preDrawDetails, or postDrawDetails method for the "text" class. > My questions are: Is that the right way to do it or should I be looking > elsewhere? Or, is there already a way to do this? > > > > As I was digging in and trying to learn how to do it, I tried to follow some > of the examples from the help page for drawDetails (?drawDetails). But, the > suggested functions to review do not exist. Specifically, I wanted to look > at grid:::preDrawDetails.frame mentioned in the second paragraph of the > Details section of the help page, and it doesn't exist. > grid:::drawDetails.xaxis and grid:::postDrawDetails.frame also do not exist > (mentioned in the next two paragraphs). > > > > I would try to make patch, but there is no preDrawDetails or postDrawDetails > method in grid that has any content. For drawDetails, there are many > choices, and since I'm learning, I'm not sure which would be the best to use > as an example. > > > > Thanks, > > > > Bill > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > <https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code.-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/