[R] Exporting Graphs

Sharpie chuck at sharpsteen.net
Sun Feb 21 21:01:51 CET 2010

Karthik wrote:
> Hello Tal,
> This is the code.
> ------------------------
>> hist(rnorm(100))
>> jpeg("histogram.jpeg")
> -----------------------
> Even when I decrease the quality, I still have the same problem.
> ----------------------------
>> hist(rnorm(100))
>> jpeg("histogram.jpeg",quality=30)
> ----------------------------
> Thank you for taking a look.
> Karthik

Hi Karthic,

You have things a little mixed around there-- use plotting commands after
you open an output device.  Like so:

  jpeg( "histogram.jpeg" )
  hist( rnorm(100) )

And when you're done, don't forget to call dev.off().  As you mentioned that
you are a beginner, I would strongly suggest flipping through the
"Introduction to R" manual.  A copy can be accessed online at:


Section 12 provides a good overview of graphics in R.

Good luck!

View this message in context: http://n4.nabble.com/Exporting-Graphs-tp1563718p1563753.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list