Description Usage Arguments Value See Also Examples
Returns ggplot of compare areas chart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | compare_areas(
data,
area,
value,
lowerci,
upperci,
fill,
order = "desc",
top_areas,
title = "",
xlab = "",
ylab = "",
legend.position = "bottom",
display.values = FALSE,
dps = 1
)
|
data |
data.frame object to plot using ggplot2 functions |
area |
field containing variable to be plotted on y axis (unquoted) |
value |
field containing variable to be plotted on x axis (unquoted) |
lowerci |
field containing variable to be plotted as lower confidence interval (unquoted - not required) |
upperci |
string; field containing variable to be plotted as upper confidence interval (unquoted - not required) |
fill |
field to be used to determine the colouring of the bars (unquoted) |
order |
one of "alphabetical", "asc" or "desc" - to determine how to order the bars |
top_areas |
character vector; the areas to fix at the top of the chart |
title |
string; title of chart |
xlab |
string; x-axis title |
ylab |
string; y-axis title |
legend.position |
the position of legends ("none", "left", "right", "bottom", "top", or two-element numeric vector) |
display.values |
logical; where or not to display the rounded values next to the bars on the chart |
dps |
number; number of decimal places to be displayed when display.values = TRUE. The default is 1. |
a ggplot of a compare areas chart
Other quick charts:
box_plots()
,
compare_indicators()
,
map()
,
overview()
,
population()
,
trends()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(dplyr)
df <- create_test_data()
parent <- "PAC11"
top_names <- c("C001", parent)
ordered_levels <- c("Better",
"Similar",
"Worse",
"Not compared")
df_ca <- df %>%
filter(IndicatorName == "Indicator 3",
(AreaCode %in% top_names |
ParentAreaCode == parent))
p <- compare_areas(df_ca, AreaCode, Value,
fill = Significance,
lowerci = LCI,
upperci = UCI,
order = "desc",
top_areas = top_names,
title = "Compare the local areas")
p
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.