You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
2.1 KiB
59 lines
2.1 KiB
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/geom-statebins.r
|
|
\docType{data}
|
|
\name{geom_statebins}
|
|
\alias{geom_statebins}
|
|
\alias{GeomStatebins}
|
|
\title{A statebins Geom (WIP!)}
|
|
\format{An object of class \code{GeomStatebins} (inherits from \code{Geom}, \code{ggproto}, \code{gg}) of length 7.}
|
|
\usage{
|
|
geom_statebins(mapping = NULL, data = NULL, border_col = "white",
|
|
border_size = 2, lbl_size = 3, dark_lbl = "black",
|
|
light_lbl = "white", radius = grid::unit(6, "pt"), ..., na.rm = FALSE,
|
|
show.legend = NA, inherit.aes = TRUE)
|
|
|
|
GeomStatebins
|
|
}
|
|
\description{
|
|
WIP!!!!!!!!!!! Full geom documentation coming soon. See Details and the Examples for now.
|
|
}
|
|
\details{
|
|
For now, you pass in:
|
|
\itemize{
|
|
\item \code{border_col} (border color of the state squares, default "\code{white}")
|
|
\item \code{border_size} (thickness of the square state borders)
|
|
\item \code{lbl_size} (the relative font size of the state label text, default \code{3})
|
|
\item \code{dark_lbl} (the color for the state label text when it shld be dark text on light background)
|
|
\item \code{light_lbl} (the color for the state label text when it shld be light text on dark background)
|
|
\item \code{radius} (corner radius --- \code{0} for a "square")
|
|
}
|
|
|
|
You also need to (ok, \emph{should}) pass in two \code{aes()} mappings:
|
|
\itemize{
|
|
\item \code{state} (so the geom knows which column to map the state names/abbrevs to)
|
|
\item \code{fill} (which column you're mapping the filling for the squares with)
|
|
}
|
|
}
|
|
\examples{
|
|
\dontrun{
|
|
library(statebins)
|
|
library(cdcfluview)
|
|
library(hrbrthemes)
|
|
library(tidyverse)
|
|
|
|
flu <- ili_weekly_activity_indicators(2017)
|
|
|
|
ggplot(flu, aes(state=statename, fill=activity_level)) +
|
|
geom_statebins() +
|
|
coord_equal() +
|
|
viridis::scale_fill_viridis(
|
|
name = "ILI Activity Level ", limits=c(0,10), breaks=0:10, option = "magma", direction = -1
|
|
) +
|
|
facet_wrap(~weekend) +
|
|
labs(title="2017-18 Flu Season ILI Activity Level") +
|
|
theme_statebins(base_family = font_ps) +
|
|
theme(plot.title=element_text(size=16, hjust=0)) +
|
|
theme(plot.margin = margin(30,30,30,30))
|
|
}
|
|
}
|
|
\keyword{datasets}
|
|
|