Problem adding a smoother with qplot if requiring point at the same time

29 views
Skip to first unread message

Jeremy Colman

unread,
Apr 12, 2016, 7:24:50 PM4/12/16
to ggplot2
`qplot(carat, price, data = dsmall, geom = c("smooth","point"))`

I get exactly what I should: smoothed line with standard error shading plus individual points.

If I don't want the shading, I try:

 `qplot(carat, price, data = dsmall, geom = c("smooth","point"),se = FALSE)`

I am working through Hadley's book "ggplot2" and in section 2.5.1 find that some of his code on adding a smoother with qplot does not work for me.

If I run:

`qplot(carat, price, data = dsmall, geom = c("smooth","point"))`

I get exactly what I should: smoothed line with standard error shading plus individual points.

If I don't want the shading, I try:

 `qplot(carat, price, data = dsmall, geom = c("smooth","point"),se = FALSE)`

I get: get:

Error: Unknown parameters: se But the parameter se miraculously becomes known if I drop the idea of "point":

`qplot(carat, price, data = dsmall, geom = c("smooth"),se = FALSE)`

yields a smoothed line without shading, just as it should.

What do I need to do to get points and smoothed line without shading?

I am using ggplot 2.1.0 and R version 3.2.3

A kind person on stackoverflow has suggested how I can achieve a smoother without the shading using ggplot2, but as the book chapter is about qplot I would like to know if it is still possible using qplot.

Frans Marcelissen

unread,
Apr 13, 2016, 1:52:51 AM4/13/16
to Jeremy Colman, ggplot2
Hi Jeremy,
se only applies to the smooth geom. This works

qplot(carat, price, data = dsmall, geom='point')+geom_smooth(se=F)

But in general it is better to use ggplot and to use qplot only for quick and dirty plots.
Success!
Frans (DigiPsy)

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bryan Hanson

unread,
Apr 13, 2016, 6:27:11 AM4/13/16
to Frans Marcelissen, Jeremy Colman, ggplot2
And so you don’t think you are going crazy:  The capabilities of qplot were recently reduced deliberately.  It sounds like you are probably working through the original ggplot2 book.  At this point, it is quite outdated.  There is a newer version available online if have the tools to build it:


Happing Plotting.  Bryan

Jeremy Colman

unread,
Apr 13, 2016, 12:45:49 PM4/13/16
to ggplot2
Many thanks indeed for such quick replies. I am particularly grateful to Brian Hanson for reassuring me about my sanity. It is also good to have an answer to the question that has been in my mind since I first encountered ggplot, namely why am I being asked to learn about qplot? It is a pity that booksellers are still selling an out of date book though. I shall look forward to the new version.
Jeremy

Jeremy Colman 2

unread,
Apr 13, 2016, 12:46:46 PM4/13/16
to Bryan Hanson, Frans Marcelissen, ggplot2
Bryan and Frans
Many thanks.
Jeremy
On 13 Apr 2016, at 11:27, Bryan Hanson <han...@depauw.edu> wrote:


Stuart Luppescu

unread,
Apr 16, 2016, 8:11:03 PM4/16/16
to Bryan Hanson, ggplot2
On Wed, 2016-04-13 at 06:27 -0400, Bryan Hanson wrote:
> There is a newer version available online if have the tools to build
> it:
>
> https://github.com/hadley/ggplot2-book

Building this requires the oldbookdown package, which is not available
for R version 3.2.4, and is designated as "deprecated". Is there any
alternative?

--
Stuart Luppescu
Chief Psychometrician
UChicago Consortium on School Research
http://consortium.uchicago.edu

lu...@uchicago.edu


Roman Luštrik

unread,
Apr 17, 2016, 1:10:56 AM4/17/16
to Stuart Luppescu, Bryan Hanson, ggplot2
Github page redirects to bookdown. Have you tried that?

Cheers,
Roman

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
In God we trust, all others bring data.

Hadley Wickham

unread,
Apr 18, 2016, 4:46:57 PM4/18/16
to Stuart Luppescu, Bryan Hanson, ggplot2
On Sat, Apr 16, 2016 at 7:10 PM, Stuart Luppescu <s...@ccsr.uchicago.edu> wrote:
> On Wed, 2016-04-13 at 06:27 -0400, Bryan Hanson wrote:
>> There is a newer version available online if have the tools to build
>> it:
>>
>> https://github.com/hadley/ggplot2-book
>
> Building this requires the oldbookdown package, which is not available
> for R version 3.2.4, and is designated as "deprecated". Is there any
> alternative?

Install it from https://github.com/hadley/oldbookdown

Hadley

--
http://hadley.nz
Reply all
Reply to author
Forward
0 new messages