plot_dot {COINr} | R Documentation |
Dot plots of single indicator with highlighting
Description
Plots a single indicator as a line of dots, and optionally highlights selected units and statistics.
This is intended for showing the relative position of units to other units, rather than as a statistical
plot. For the latter, use plot_dist()
.
Usage
plot_dot(
coin,
dset,
iCode,
Level = NULL,
...,
usel = NULL,
marker_type = "circle",
add_stat = NULL,
stat_label = NULL,
show_ticks = TRUE,
plabel = NULL,
usel_label = TRUE,
vert_adjust = 0.5
)
Arguments
coin |
The coin |
dset |
The name of the data set to apply the function to, which should be accessible in |
iCode |
Code of indicator or aggregate found in |
Level |
The level in the hierarchy to extract data from. See |
... |
Further arguments to pass to |
usel |
A subset of units to highlight. |
marker_type |
The type of marker, either |
add_stat |
A statistic to overlay, either |
stat_label |
An optional string to use as label at the point specified by |
show_ticks |
Set |
plabel |
Controls the labelling of the indicator. If |
usel_label |
If |
vert_adjust |
Adjusts the vertical height of text labels and stat lines, which matters depending on plot size. Takes a value between 0 to 2 (higher will probably remove the label from the axis space). |
Details
This function uses ggplot2 to generate plots, so the plot can be further manipulated using ggplot2 commands.
See vignette("visualisation
) for more details on plotting.
This function replaces the now-defunct plotIndDot()
from COINr < v1.0.
Value
A ggplot2 plot object.
Examples
# build example coin
coin <- build_example_coin(up_to = "new_coin")
# dot plot of LPI, highlighting two countries and with median shown
plot_dot(coin, dset = "Raw", iCode = "LPI", usel = c("JPN", "ESP"),
add_stat = "median", stat_label = "Median", plabel = "iName+unit")