Hi, It really depends, but almost always to plot a graph you would use plot() (or some similar graphing function). print() is usually more for displaying data in the console, not graphically. There are some cases (e.g., inside a for loop), where you need to wrap the call to plot (or similar graphing function) in print() (lattice graphics is probably the most common example here). Here is an example/demonstration of plot() and print() in the context of a histogram (which was calculated and saved into an object called 'x'):
## do histogram calculations but do not plot x <- hist(rnorm(1000), plot = FALSE) ## print() just shows you the data print(x) ## put data in a graph plot(x) ## but you could also just use hist() without plot() or print() hist(runif(100)) HTH, Josh On Tue, Nov 16, 2010 at 9:09 AM, skan <juanp...@gmail.com> wrote: > > 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@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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ R-help@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.