Skip to content

span parameter won't work in geom_smooth #1292

Closed
@GuangchuangYu

Description

@GuangchuangYu

In reading the book, I found the figures in page 19 are almost identical with different span parameters (0.2 and 1 respectively).

I believe it may due to the figure size that is too small and try to enlarge it and recompile the chapter.

I got identical figures with several try (ggplot2 version = 1.0.1.9003).

 require(ggplot2)
 require(gridExtra)

grid.arrange(
    ggplot(mpg, aes(displ, hwy)) + 
      geom_point() + 
      geom_smooth(span = .2),

    ggplot(mpg, aes(displ, hwy)) + 
      geom_point() + 
      geom_smooth(span = 1),

    ncol=2)

I removed the latest version of ggplot2 (installed today, Aug. 25), and re-install it from CRAN (version = 1.0.1).

With this version, span works:

There may be something wrong in the newest version of ggplot2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions