ggBar: Draw an interactive barplot

Description Usage Arguments Value Examples

Description

Draw an interactive barplot

Usage

1
2
3
4
ggBar(data, xvar, fillvar, yvar = NULL, stat = "count",
  position = "stack", palette = NULL, width = NULL, digits = 1,
  horizontal = FALSE, yangle = 0, addlabel = FALSE, polar = FALSE,
  interactive = FALSE, ...)

Arguments

data

A data.frame

xvar

A character string of column name be assigned to the x-axis variable

fillvar

A character string of column name be assigned to the fill variable

yvar

A character string of column name be assigned to the y-axis variable. Uses only when stat="identity".

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

width

Bar width

digits

integer indicating the number of decimal places

horizontal

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

yangle

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

addlabel

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

polar

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

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
require(moonBook)
require(ggplot2)
require(ggiraph)
ggBar(acs,"Dx","smoking",interactive=TRUE,width=1,colour="white",size=0.2,polar=TRUE)
ggBar(acs,"Dx","smoking",position="fill",addlabel=TRUE,horizontal=TRUE,width=0.5)
ggBar(acs,"Dx","smoking",position="fill",interactive=TRUE,addlabel=TRUE)
ggBar(acs,"Dx","smoking",position="dodge",interactive=TRUE)
ggBar(rose,Month,group,"value",stat="identity",polar=TRUE,palette="Reds",width=1,
      color="black",size=0.1,interactive=TRUE)

cardiomoon/moonBook2 documentation built on May 13, 2019, 12:40 p.m.