Description Usage Arguments Examples
Create interactive d3.js exploding boxplots using d3_exploding_boxplot
1 2 3 |
data |
|
y |
|
group |
|
color |
|
label |
|
margin |
|
xlab |
|
ylab |
|
width, height |
any valid |
elementId |
likely |
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # devtools::install_github("timelyportfolio/explodingboxplotR")
library(explodingboxplotR)
# use this to replicate
# from ?boxplot
#boxplot(count ~ spray, data = InsectSprays, col = "lightgray")
exploding_boxplot(
data.frame(
rowname = rownames(InsectSprays),
InsectSprays,
stringsAsFactors = FALSE
),
y = "count",
group = "spray",
color = "spray",
label = "rowname"
)
# demonstrate all of the options
# xlab does not work
# filed issue on source repo
exploding_boxplot(
data.frame(
rowname = rownames(InsectSprays),
InsectSprays,
stringsAsFactors = FALSE
),
y = "count",
group = "spray",
color = "spray",
label = "rowname",
iqr = 2,
margin = list(bottom = 50, left = 30, top = 20, right = 20),
xlab = "Spray Type",
ylab = "Count Provided"
)
# use new htmlwidgets on render to customize tooltip
htmlwidgets::onRender(
exploding_boxplot(
data.frame(
rowname = rownames(InsectSprays),
InsectSprays,
stringsAsFactors = FALSE
),
y = "count",
group = "spray",
color = "spray",
label = "rowname"
),
"
function(){
this.chart.tip.html(function(d){
return [
'<span style = \\'font-size:150%\\'>',
d.spray,
' | ',
'</span>',
' count of',
d.count,
' from rowname ',
d.rowname
].join('\\n')
})
}
"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.