[R] Adding margin text to lattice graphics
baptiste.auguie at googlemail.com
Mon Apr 11 00:23:41 CEST 2011
Yes, very sorry about this -- I had subconsciously ignored the
hypothetical possibility that anyone wouldn't have ggplot2 loaded in
their .Rprofile ;)
Replacing mpg with beaver1 (datasets) should be more reproducible.
That being said, I was told off-list that this is not answering at all
the question, whatever it was.
On 11 April 2011 09:54, Mark Leeds <markleeds2 at gmail.com> wrote:
> hi baptiste: thanks for that but how do I get mpg ? I got an error that R
> couldn't find it. thanks again.
> On Sat, Apr 9, 2011 at 9:45 PM, baptiste auguie
> <baptiste.auguie at googlemail.com> wrote:
>> You may want to read about ?viewport in the grid package. They allow
>> you to position graphical elements wherever you want on a page, such
>> as lattice plots and text (grid.text). For a high-level interface, you
>> could try the following,
>> p1 = xyplot(1~1)
>> p2 = levelplot(volcano)
>> p3 = tableGrob(head(mpg[, 1:3]))
>> p4 = textGrob("some text")
>> grid.arrange(p1, p2, p3, p4, main="global page title",
>> sub=p4, left="page y-label")
>> On 10 April 2011 13:33, Dennis Fisher <fisher at plessthan.com> wrote:
>> > Colleagues
>> > I am learning lattice graphics (R 2.12.2; OS X). Several days ago, I
>> > inquired about adding margin text to lattice graphics. Jim Price offered a
>> > useful reply, suggesting that I add:
>> > page = function(page) grid.text('words', x = 0.5, y = 0.01)
>> > to my call to the function. The entire function that he suggested was;
>> > xyplot(1 ~ 1,
>> > par.settings = list(layout.heights = list(bottom.padding = 10)),
>> > page = function(page) grid.text('words', x = 0.5, y = 0.01))
>> > That worked initially and I also had success with panel.text.
>> > However, I am now working with more complicated objects in which more
>> > than one image is displayed on a page. In this instance, the text added by
>> > the command above appears with each image. I would like it to appear only
>> > once, scaled across the entire page, not relative to a single panel.
>> > Is there a different command that accomplishes my goal? Or a different
>> > implementation of this same command? Any help would be greatly appreciated.
>> > Also, because of my naivete with lattice graphics, I may be asking the
>> > question in entirely the wrong way -- please feel free to redirect me.
>> > Dennis
>> > Dennis Fisher MD
>> > P < (The "P Less Than" Company)
>> > Phone: 1-866-PLessThan (1-866-753-7784)
>> > Fax: 1-866-PLessThan (1-866-753-7784)
>> > www.PLessThan.com
>> > ______________________________________________
>> > R-help at 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 at r-project.org mailing list
>> PLEASE do read the posting guide
>> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help