[R] plot vs print ??
Greg Snow
Greg.Snow at imail.org
Thu Nov 18 00:40:07 CET 2010
Well, assuming this refers to the histogram function in the lattice package, looking at the code for print.trellis shows that the default behavior is to call plot.trellis with the same arguments. So unless you change the default behavior, there really is no difference between printing and plotting (except maybe one more step in the call stack).
Using print can allow you to do something else if you set the print.function option in lattice to something else. The idea of "printing" graphs to plot them comes because the R interpreter will print (call the print method) on objects that are returned from functions at the top level and not saved into a variable (and possibly other cases), having a print method that plots means that calls to histogram and others without saving or doing other things will cause the object to be plotted, which is generally what the user wants.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of skan
> Sent: Tuesday, November 16, 2010 10:10 AM
> To: r-help at r-project.org
> Subject: [R] plot vs print ??
>
>
> Hello
>
> What's the differente betwen using "plot" and using "print" in order
> to
> plot a graph?
> For example in order to plot the result of a histogram.
>
> cheers
> --
> View this message in context: http://r.789695.n4.nabble.com/plot-vs-
> print-tp3045256p3045256.html
> Sent from the R help mailing list archive at Nabble.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.
More information about the R-help
mailing list