Last active
June 29, 2018 01:28
-
-
Save bluetyson/21d9c8ffaf1655338b186e6fa9ecad6c to your computer and use it in GitHub Desktop.
idea for ggplot htmlwidget interactive loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#how to output a list of interactive ggplots . e.g. so can click on a bar and something happens..basics.. a loop of basic ggplots will output, but not the ggiraph version | |
x <- 0 | |
for(i in unique(checkfiles$Volume)){ | |
x <- x + 1 | |
plotserieslines3 <- function(yvar){ | |
data <- subset(checkfiles, Volume == i) | |
cat("\n\n## Volume Click = ", i, "\n\n") | |
gg_crime9 <- ggplot(data,aes(Volume,fill=Volume))+ | |
geom_bar_interactive (stat="count")+ | |
aes(data_id = Volume, tooltip = Volume, onclick = onclick) + | |
theme(axis.text.x=element_text(angle=45,hjust=1,vjust=1,size=6)) + | |
ggtitle("ROT Data counts") | |
#scale_fill_manual(values=c("black", "#faba00", "white")) | |
ggiraph(code = print(gg_crime9), hover_css = "fill-opacity:.3;cursor:pointer;") | |
} | |
#print(htmltools::taglist(list3)) | |
#list4 <- lapply(names(spt2)[x], plotserieslines3) | |
#tagList(list4) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment