RE: [R] y-axis of lattice panels not printing to paper

From: Pam Goodman <pgoodman_at_nwifc.org>
Date: Fri 02 Jul 2004 - 08:24:03 EST


Deepayan,
Thanks for the suggestions for changing the size of the screen devices/win.print. They did not work for me.

Mea culpa, I neglected in my orinal email to say that it's just the vertical line of the y-axis that does not print, not the entire y-axis and associated labels. Tick marks, tick labels, and the y-axis label print nicely. Hopefully, this information will help isolate the problem (?).

Also, I should note that our office has the option of printing through our network to an HP laser printer or to a photocopier, and both of these options produce the same problem, no vertical line of the y-axis. Our default paper size, which I have been using, is 8.5x11 inches.

Thanks again!

Pam

-----Original Message-----
From: Deepayan Sarkar [mailto:deepayan@cs.wisc.edu] Sent: Thursday, July 01, 2004 12:41 PM
To: Pam Goodman
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] y-axis of lattice panels not printing to paper

Quoting Pam Goodman <pgoodman@nwifc.org>:

> Greetings,
>
> I am printing lattice plots from the R-interface to a printer, and although
> the y-axes of the left-most panels are visable on the screen, they are not
> present on the paper when there are multiple panels (ie, >1).
>
> For example:
>
> trellis.device(bg='white')
> histogram(~dbh, data=diameter.df)
>
> ###print to a printer from the R-interface by clicking the print button on
> the toolbar
>
> The above prints fine. All axes intact.
>
> However,
> trellis.device(bg='white')
> histogram(~dbh|species, data=diameter.df)
>
> ###print to a printer from the R-interface by clicking the print button on
> the main toolbar
>
> This second example does not have y-axes for the left-most panels.
>
> There is at least one work-around. For example, if I copy/paste as a metafile
> into Word, the axes are present in the printed document. However, I'm
> currently in the EDA phase, it's relatively more convenient to print directly
> to the printer, because in reality I have several graphs I am printing in a
> loop:
>
> trellis.device(bg='white')
> for(i in 1:50){
> print(histogram(~dbh|species.c, data=eval(parse(text=site.names.sort[i])),
> breaks=c(0,seq(4,92,by=2)), main=site.names.sort[i], type="density"))
> dev.copy()
> dev.print(device=win.print)
> }
>
> All 50 of the plots lack the y-axes in the left-most panels. Also, I tested
> xyplot(), and I get the same behavior.
>
> How can I get the y-axes of the left-most panels to be printed to the page?

I have no idea what the problem is. Might it have something to do with paper size? Does changing the size of your screen devices/win.print help?

I should mention that this is probably not a good way to print lattice graphs. The settings for screen devices are not suitable for printing. I think there are also more general issues with converting output of one device to another (I don't understand all the details). In this situation, I would use

trellis.device(pdf, file = "foo.pdf")
for(i in 1:50){
  print(histogram(~dbh|species.c, data=eval(parse(text=site.names.sort[i])),   breaks=c(0,seq(4,92,by=2)), main=site.names.sort[i], type="density"))   }
dev.off()

and then print the PDF file.

Deepayan



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Jul 02 08:30:42 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:15:28 EST