ggplot(data=profile, aes(x=height, fill=gender)) + geom_bar(aes(y=..count..), position="stack", stat="bin")
texasPrecipitation <- ggplot() + geom_tallrect(aes(xmin=min.day, xmax=max.day, clickSelects=week), data=statesummary, alpha=.1, fill="black", color="black") + geom_rect(aes(xmin=min.day, xmax=max.day, ymin=0, ymax=precip.median, clickSelects=week), data=statesummary) + geom_point(aes(x=day, y=precip.max), size=4, fill="transparent", color="black", data=statesummary) + geom_text(aes(x=ymd("2015-04-15"), y=16, label=label, showSelected=week), data=statesummary) + xlab("") + ylab("Weekly Precipitation (in)") + ggtitle("Precipitation across Texas, 2015") + theme_animint(width=350, height=540)
animint2dir( list( # list of all of the plots to # render with animint precip = texasPrecipitation ) )
texasOutline <- ggplot() + geom_path(data=rivers, aes(x=long, y=lat, group=group), color="grey", size=.5) + geom_polygon(data=lakes, aes(x=long, y=lat, group=group), fill="grey", size=.5) + geom_path(data=tx, aes(x=long, y=lat, group=group)) + theme(axis.line = element_blank(), axis.text = element_blank(), axis.ticks = element_blank(), axis.title = element_blank()) + theme_animint(width=600, height=540) # Size of the plot when rendered in HTML
weatherStations <- texasOutline + ggtitle("Weekly Precipitation") + geom_point(data=weathersummary, aes(x=longitude, y=latitude, # Standard aesthetics showSelected=week, tooltip=station.name,# animint aes fill=precip.wk), color="black", size=4) + # animint specifies fill and color separately for points scale_fill_gradient2("Precip (in)", low="white", mid="steelblue1", midpoint=10, high="steelblue3")
animint2dir()
saves an index.html file, required javascript files, the JSON plot description, and data to a local directory animint2gist()
posts a gist to your github account (which can be viewed using http://bl.ocks.org/) structure(..., class="animint")
will create an interactive applet when knitting output to HTML renderAnimint() and animintOutput()
create an animint applet within a shiny app selector.types = list(station = "multiple")
aes(tooltip = label)
aes(id = idvar)
allows for customization with CSS aes(href = url)
creates links that open in a new tab aes(key = variable)
creates smooth transitions first = list(variable = value)
will select "value" on initial load