ggBar: Draw an interactive barplot

Description Usage Arguments Value Examples

View source: R/ggBar.R

Description

Draw an interactive barplot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
ggBar(
  data,
  mapping,
  stat = "count",
  position = "stack",
  palette = NULL,
  horizontal = FALSE,
  yangle = 0,
  xangle = 0,
  maxylev = 6,
  addlabel = FALSE,
  labelsize = 5,
  polar = FALSE,
  reverse = FALSE,
  use.label = TRUE,
  use.labels = TRUE,
  interactive = FALSE,
  ...
)

Arguments

data

A data.frame

mapping

Set of aesthetic mappings created by aes or aes_.

stat

The statistical transformation to use on the data for this layer, as a string c("count","identity")

position

Position adjustment. One of the c("fill","stack","dodge")

palette

A character string indicating the color palette

horizontal

A logical value. If TRUE,a horizontal bar plot will be returned

yangle

An integer. The value will be used adjust the angle of axis.text.y

xangle

An integer. The value will be used adjust the angle of axis.text.x

maxylev

integer indicating threshold of unique value to be treated as a categorical variable

addlabel

A logical value. If TRUE, label will be added to the plot

labelsize

label size

polar

A logical value. If TRUE, coord_polar() function will be added

reverse

If true, reverse palette colors

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

interactive

A logical value. If TRUE, an interactive plot will be returned

...

other arguments passed on to geom_bar_interactive.

Value

An interactive barplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(moonBook)
require(ggplot2)
require(ggiraph)
require(plyr)
ggBar(acs,aes(x=Dx,fill=smoking),interactive=TRUE,width=1,colour="white",size=0.2,polar=TRUE)
ggBar(acs,aes(x=Dx,fill=smoking),position="fill",addlabel=TRUE,horizontal=TRUE,width=0.5)
ggBar(acs,aes(x=Dx,fill=smoking),position="dodge",interactive=TRUE,addlabel=TRUE)
ggBar(acs,aes(x=Dx,fill=smoking),position="fill",addlabel=TRUE)
ggBar(rose,aes(x=Month,fill=group,y=value),stat="identity",polar=TRUE,palette="Reds",width=1,
      color="black",size=0.1,reverse=TRUE,interactive=TRUE)

Example output

Loading required package: moonBook
Loading required package: ggplot2
Loading required package: ggiraph
Loading required package: plyr
Using nrow as value column: use value.var to override.
Warning: Ignoring unknown parameters: reverse

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