ggDensity: Make a density plot with histogram

Description Usage Arguments Examples

View source: R/ggDensity.R

Description

Make a density plot with histogram

Usage

1
2
3
4
5
6
7
8
ggDensity(
  data,
  mapping,
  linecolor = "red",
  addhist = TRUE,
  use.label = TRUE,
  use.labels = TRUE
)

Arguments

data

a data.frame

mapping

Set of aesthetic mappings created by aes or aes_.

linecolor

Color of density curve

addhist

Whether add histogram or not

use.label

Logical. Whether or not use column label in case of labelled data

use.labels

Logical. Whether or not use value labels in case of labelled data

Examples

1
2
3
4
5
6
7
require(ggplot2)
require(moonBook)
ggDensity(acs,aes(x=age))
ggDensity(acs,aes(x=age,color=sex,fill=sex),addhist=FALSE)
ggDensity(acs,aes(x=age,color=sex,fill=sex))
ggDensity(acs,aes(x=age,fill=sex),addhist=FALSE)
ggDensity(acs,aes(x=age,color=sex))

Example output

Loading required package: ggplot2
Loading required package: moonBook

Attaching package: 'moonBook'

The following objects are masked from 'package:ggiraphExtra':

    addLabelDf, getMapping

`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

ggiraphExtra documentation built on Oct. 23, 2020, 7:39 p.m.