Description Usage Arguments Value Examples
Draw an interactive spinogram
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ggSpine(
data,
mapping,
stat = "count",
position = "fill",
palette = "Blues",
interactive = FALSE,
polar = FALSE,
reverse = FALSE,
width = NULL,
maxylev = 6,
digits = 1,
colour = "black",
size = 0.2,
addlabel = TRUE,
labelsize = 5,
minlabelgroup = 0.04,
minlabel = 2,
hide.legend = TRUE,
ylabelMean = FALSE,
sec.y.axis = FALSE,
use.label = TRUE,
use.labels = TRUE,
labeller = NULL,
facetbycol = TRUE,
xangle = NULL,
yangle = NULL,
xreverse = FALSE,
yreverse = FALSE,
xlab = NULL,
filllab = NULL,
family = NULL,
...
)
|
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 |
interactive |
A logical value. If TRUE, an interactive plot will be returned |
polar |
A logical value. If TRUE, coord_polar() function will be added |
reverse |
If true, reverse palette colors |
width |
Bar width |
maxylev |
integer indicating threshold of unique value to be treated as a categorical variable |
digits |
integer indicating the number of decimal places |
colour |
Bar colour |
size |
Bar size |
addlabel |
A logical value. If TRUE, label will be added to the plot |
labelsize |
label size |
minlabelgroup |
minimal threshold of label group. Default is 0.04 |
minlabel |
minimal threshold of label. Default is 2 |
hide.legend |
A logical value. If TRUE, the legend is removed and y labels are recreated |
ylabelMean |
Logical. If TRUE, y axis labels are positioned at mean value. |
sec.y.axis |
Logical. If TRUE, secondary y axis is shown at the right side. |
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 |
labeller |
A function that takes one data frame of labels and returns a list or data frame of character vectors. |
facetbycol |
Logical. If TRUE, facet by column. |
xangle |
angle of axis label |
yangle |
angle of axis label |
xreverse |
Logical. Whether or not reverse x-axis |
yreverse |
Logical. Whether or not reverse y-axis |
xlab |
Label for x-axis |
filllab |
Label for fill aes |
family |
font family |
... |
other arguments passed on to geom_rect_interactive. |
An interactive spinogram
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | require(moonBook)
require(ggplot2)
acs$Dx=factor(acs$Dx,levels=c("Unstable Angina","NSTEMI","STEMI"))
ggSpine(data=acs,aes(x=age,fill=Dx,facet=sex),palette="Reds")
ggSpine(data=acs,aes(x=age,fill=Dx,facet=sex),facetbycol=FALSE,minlabelgroup=0.02)
ggSpine(data=acs,aes(x=age,fill=Dx),palette="Reds")
ggSpine(data=acs,aes(x=smoking,fill=Dx),palette="Reds")
ggSpine(data=acs,aes(x=DM,fill=Dx,facet=sex),palette="Reds")
ggSpine(data=acs,aes(x=Dx,fill=smoking,facet=sex),palette="Reds")
ggSpine(data=acs,aes(x=DM,facet=smoking,fill=Dx),sec.y.axis=TRUE)
ggSpine(data=acs,aes(x=DM,facet=smoking,fill=Dx),facetbycol=FALSE)
ggSpine(mtcars,aes(x=gear,fill=carb),interactive=TRUE)
ggSpine(mtcars,aes(x=gear,fill=carb,facet=am))
ggSpine(data=acs,aes(x=Dx,fill=smoking),position="dodge")
ggSpine(data=acs,aes(x=Dx,fill=smoking),position="stack")
|
Loading required package: moonBook
Attaching package: 'moonBook'
The following objects are masked from 'package:ggiraphExtra':
addLabelDf, getMapping
Loading required package: ggplot2
Warning messages:
1: In bind_rows_(x, .id) : Unequal factor levels: coercing to character
2: In bind_rows_(x, .id) :
binding character and factor vector, coercing into character vector
3: In bind_rows_(x, .id) :
binding character and factor vector, coercing into character vector
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.