Description Usage Arguments Details Value Note Examples
Takes a ggplot object that has a single geom (it can be geom_line, geom_point or geom_histogram) and converts it to it's tauchart counterpart. It will do it's best to identify plot labels, mapped size & color aesthetics, and x/y limits.
1 | as_tauchart(gg)
|
gg |
ggplot object |
If there are aesthetic mappings, as_tauchart
will automaticlly add
a legend.
Currently supports:
geom_point
geom_line
geom_bar
geom_histogram
tauchart object
More aesthetic mappings are planned
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 | if (interactive()) {
library(ggplot2)
dat <- data.frame(year=seq(1790, 1970, 10),
uspop=as.numeric(uspop))
set.seed(5689)
data(movies, package="ggplot2")
movies <- movies[sample(nrow(movies), 1000), ]
gg <- ggplot(dat, aes(x=year, y=uspop)) + geom_line()
as_tauchart(gg)
gg <- ggplot(dat, aes(x=year, y=uspop)) + geom_point()
as_tauchart(gg)
gg <- ggplot(dplyr::count(movies, rating), aes(rating, n)) + geom_bar(stat="identity")
as_tauchart(gg)
gg <- ggplot(mtcars) + geom_point(aes(x=mpg, y=wt, color=cyl))
as_tauchart(gg)
gg <- ggplot(mtcars, aes(x=mpg, y=wt, color=am, size=wt)) + geom_point()
as_tauchart(gg)
data(economics, package="ggplot2")
gg <- ggplot(economics) + geom_line(aes(x=date, y=unemploy))
as_tauchart(gg) %>% tau_guide_x(tick_format="%Y")
gg <- ggplot(mtcars, aes(as.factor(cyl))) + geom_histogram()
as_tauchart(gg)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.