[R] does qplot works with Sweave?
hadley wickham
h.wickham at gmail.com
Tue Oct 28 22:06:54 CET 2008
You need to explicitly print ggplot objects:
print(qplot(carat,price,data=dsmall,colour = color))
Hadley
On Tue, Oct 28, 2008 at 3:43 PM, Felipe Carrillo
<mazatlanmexico at yahoo.com> wrote:
> Hi Hadley:
> I'm practicing writing a document using MikTex but can't make qplot to execute. It works when using 'plot' though. Is this a normal behaviour?
>
>
> \documentclass[9pt]{article}
> \title{ggplot2 example}
>
> \begin{document}
>
> \maketitle
> \section*{Examples of using ggplot2}
> The goal is to be able to import ggplot2 graphics into the annual report.
> Hadley Wickham has done a great job by creating this free R package.
> Let's get some data into R from one the built-in packages:
> We'll work with the diamonds data. This dataset is really large, it accounts for
> over 50.000 records. We will demostrate how to create nice and colorful graphics
> as well as creating some nice tabular tables with horizontal and vertical lines.
>
> <<dataAnalysis.R,echo=F>>=
> data(diamonds)
> attach(diamonds)
> dsmall <- diamonds[sample(nrow(diamonds),1000),]
> @
> \begin{figure}[h]
> <<fig.R,echo=FALSE,fig=TRUE,width=6,height=7>>=
> qplot(carat,price,data=dsmall,colour = color) #THIS CODE DOESN'T WORK
> @
> \end{figure}
>
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
> ______________________________________________
> 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.
>
--
http://had.co.nz/
More information about the R-help
mailing list