Extra Coordinate Systems, 'Geoms', Statistical Transformations, Scales and Fonts for 'ggplot2'
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hrbrmstr 809f51c49c initial commit 9 years ago
R initial commit 9 years ago
README_figs initial commit 9 years ago
man initial commit 9 years ago
tests initial commit 9 years ago
.Rbuildignore initial commit 9 years ago
.gitignore initial commit 9 years ago
.travis.yml initial commit 9 years ago
CONDUCT.md initial commit 9 years ago
DESCRIPTION initial commit 9 years ago
LICENSE initial commit 9 years ago
NAMESPACE initial commit 9 years ago
README.Rmd initial commit 9 years ago
README.md initial commit 9 years ago
ggalt.Rproj initial commit 9 years ago

README.md

ggalt : Extra Geoms, Stats and Coords for ggplot2

A package containing additional geoms, coords and stats for the revamped (late 2015) version of ggplot2.

The first two forays into this brave, new ggplot2 world are splines! and being able to use the (much better) KernSmooth::bkde for density plots.

NOTE

Until the new ggplot2 version is on CRAN, you'll need to install it from github (see below).

The following functions are implemented:

  • geom_xspline : Connect control points/observations with an X-spline
  • stat_xspline : Connect control points/observations with an X-spline
  • geom_bkde : Display a smooth density estimate (uses KernSmooth::bkde)
  • stat_bkde : Display a smooth density estimate (uses KernSmooth::bkde)

News

  • Version 0.0.1.9000 released

Installation

# you'll want to see the vignettes, trust me
devtools::install_github("hadley/ggplot2", build_vignettes=TRUE)
devtools::install_github("hrbrmstr/ggalt")

Usage

library(ggalt)
#> Loading required package: ggplot2

# current verison
packageVersion("ggalt")
#> [1] '0.0.1.9001'

set.seed(1492)
dat <- data.frame(x=c(1:10, 1:10, 1:10),
                  y=c(sample(15:30, 10), 2*sample(15:30, 10), 3*sample(15:30, 10)),
                  group=factor(c(rep(1, 10), rep(2, 10), rep(3, 10)))
)

ggplot(dat, aes(x, y, group=group, color=group)) +
  geom_point() +
  geom_line()


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point() +
  geom_line() +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=-0.4, size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=0.4, size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=1, size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=0, size=0.5)


ggplot(dat, aes(x, y, group=group, color=factor(group))) +
  geom_point(color="black") +
  geom_smooth(se=FALSE, linetype="dashed", size=0.5) +
  geom_xspline(spline_shape=-1, size=0.5)


# Better density plots

data(geyser, package="MASS")

ggplot(geyser, aes(x=duration)) + 
  stat_bkde(bandwidth=0.25)


ggplot(geyser, aes(x=duration)) +
  geom_bkde(bandwidth=0.25)

Test Results

library(ggalt)
library(testthat)

date()
#> [1] "Tue Sep  8 16:16:44 2015"

test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 0 SKIPPED: 0 FAILED: 0
#> 
#> DONE

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.