Browse Source

comma gone

master
boB Rudis 5 years ago
parent
commit
6709f5e072
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 13
      R/geom-econodist.R
  2. 24
      inst/tinytest/test_ggeconodist.R
  3. 6
      man/econodist_legend_grob.Rd
  4. 13
      man/geom_econodist.Rd

13
R/geom-econodist.R

@ -86,10 +86,19 @@ draw_key_econodist <- function(data, params, size) {
#' @examples #' @examples
#' ggplot(mammogram_costs, aes(x = city)) + #' ggplot(mammogram_costs, aes(x = city)) +
#' geom_econodist( #' geom_econodist(
#' aes(ymin = tenth, median = median, ymax = ninetieth), #' aes(
#' ymin = tenth,
#' median = median,
#' ymax = ninetieth
#' ),
#' stat = "identity", #' stat = "identity",
#' ) + #' ) +
#' scale_y_comma(expand = c(0,0), position = "right", limits = range(0, 800)) + #' scale_y_continuous(
#' expand = c(0,0),
#' position = "right",
#' limits = range(0, 800),
#' label = scales::comma
#' ) +
#' coord_flip() + #' coord_flip() +
#' labs( #' labs(
#' x = NULL, y = NULL #' x = NULL, y = NULL

24
inst/tinytest/test_ggeconodist.R

@ -1,4 +1,24 @@
library(ggeconodist)
# Placeholder with simple test ggplot(mammogram_costs, aes(x = city)) +
expect_equal(1 + 1, 3) geom_econodist(
aes(ymin = tenth, median = median, ymax = ninetieth),
stat = "identity",
) -> gg
gb <- ggplotGrob(gg)
expect_true(inherits(gb, "gtable"))
expect_true(identical(dim(gb$layout), c(18L, 7L)))
add_econodist_legend(
gg,
econodist_legend_grob(
tenth_col = "#b07aa1",
ninetieth_col = "#591a4f",
),
below = "subtitle",
just = "right"
) -> gt
expect_true("econodist-legend" %in% gt$layout$name)

6
man/econodist_legend_grob.Rd

@ -15,11 +15,11 @@ econodist_legend_grob(family = "EconSansCndLig", label_size = 10,
\item{label_size}{size of legend text} \item{label_size}{size of legend text}
\item{tenth_col}{color for the tenth bar} \item{tenth_lab, tenth_col}{label & color for the tenth bar}
\item{med_col}{color for the median point} \item{med_lab, med_col}{label & color for the median point}
\item{ninetieth_col}{color for the ninetieth bar} \item{ninetieth_lab, ninetieth_col}{lanbel & color for the ninetieth bar}
\item{label_col}{color of the legend text} \item{label_col}{color of the legend text}
} }

13
man/geom_econodist.Rd

@ -81,10 +81,19 @@ statistics.
\examples{ \examples{
ggplot(mammogram_costs, aes(x = city)) + ggplot(mammogram_costs, aes(x = city)) +
geom_econodist( geom_econodist(
aes(ymin = tenth, median = median, ymax = ninetieth), aes(
ymin = tenth,
median = median,
ymax = ninetieth
),
stat = "identity", stat = "identity",
) + ) +
scale_y_comma(expand = c(0,0), position = "right", limits = range(0, 800)) + scale_y_continuous(
expand = c(0,0),
position = "right",
limits = range(0, 800),
label = scales::comma
) +
coord_flip() + coord_flip() +
labs( labs(
x = NULL, y = NULL x = NULL, y = NULL

Loading…
Cancel
Save