View source: R/plot_indicator.R
plot_indicator | R Documentation |
'plot_indicator' produces a combined lineplot and dotplot for selected countries and indicators from the V-Dem data set.
plot_indicator(
indicator,
countries = NULL,
min_year = min(vdemdata::vdem$year),
max_year = max(vdemdata::vdem$year),
uncertainty = T
)
indicator |
Character vector containing the indicators from the V-Dem data that are plotted (see codebook). |
countries |
Character vector containing the countries that are plotted. Only countries from the country_name column in the V-Dem data are accepted. If no countries are specified the global averages are plotted. |
min_year |
Numeric value representing the lower bound of the time frame (years) to be plotted. |
max_year |
Numeric value representing the upper bound of the time frame (years) to be plotted. |
uncertainty |
Logical value: adds uncertainty intervals to point estimates if available. |
This function is a wrapper for [ggplot2:ggplot()] and produces a combined lineplot and dotplot for selected indicators from the V-Dem dataset. It allow users to select multiple indicators as well as multiple countries. Users can adjust the time frame to be plotted. The function offers some sensible defaults for plotting. Additional plot options from [ggplot2:ggplot()] can be added outside the function call. Note that this function is mainly for exploratory analyses and might not be useful for all types of indicators in the data.
The output of this function is a [ggplot2:ggplot()] object with lines and points for global averages of the selected indicators or point estimates for selected countries.
## Not run:
# Plot V-Dem indicators liberal democracy and egalitarian democracy
# for Sweden and Germany between 1912 and 2000.
plot_indicator(indicator=c( "v2x_egaldem", "v2x_libdem"), countries = c("Germany", "Sweden"),
min_year = 1912, max_year = 2000)
# Plot the global averages of V-Dem indicators electoral and egalitarian democracy
# between 1940 and 2010.
plot_indicator(indicator=c("v2x_polyarchy", "v2x_egaldem"),
min_year = 1940, max_year = 2010)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.