Description Usage Arguments Value See Also Examples
Plot trend chart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
data |
data.frame object to plot using ggplot2 functions |
timeperiod |
field containing the time period (unquoted) |
value |
field containing variable to be plotted on x axis (unquoted) |
area |
field containing variable to be plotted on y axis (unquoted) |
comparator |
string; name of comparator area (this should exist in the field described by the area parameter) |
area_name |
string; name of the local area (this should exist in the field described by the area parameter) |
fill |
field to be used to determine the colouring of the bars (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) |
title |
string; title of chart |
subtitle |
string; text to use as subtitle to graph |
xlab |
string; x-axis title |
ylab |
string; y-axis title |
point_size |
number; size of point |
a ggplot of trends for an indicator alongside a comparator
Other quick charts:
box_plots()
,
compare_areas()
,
compare_indicators()
,
map()
,
overview()
,
population()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(dplyr)
df <- create_test_data()
df_trend <- df %>%
arrange(IndicatorName) %>%
mutate(Timeperiod = rep(c("2011", "2012", "2013", "2014", "2015", "2016"),
each = 111))
p <- trends(df_trend,
timeperiod = Timeperiod,
value = Value,
area = AreaCode,
comparator = "C001",
area_name = "AC142",
fill = Significance,
lowerci = LCI,
upperci = UCI,
title = "Trend compared to country",
subtitle = "For area AC142",
xlab = "Year",
ylab = "Value (%)")
p
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.