Most of the time, barplot or lollipop plots are plotted vertically with the Y-axis representing the value of the numeric variable. If your labels on the X-axis are long, they need to be rotated
in order not to overlap.
As a result, these labels become hard to read:
# Libraries
library(tidyverse)
library(hrbrthemes)
library(kableExtra)
options(knitr.table.format = "html")
# Load dataset from github
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/7_OneCatOneNum.csv", header=TRUE, sep=",")
# Barplot
data %>%
filter(!is.na(Value)) %>%
arrange(Value) %>%
tail(20) %>%
mutate(Country=factor(Country, Country)) %>%
ggplot( aes(x=Country, y=Value) ) +
geom_bar(stat="identity", fill="#69b3a2") +
theme_ipsum() +
theme(
panel.grid.minor.x = element_blank(),
panel.grid.major.x = element_blank(),
legend.position="none",
axis.text.x = element_text(angle = 80, hjust=1)
) +
xlab("") +
ylab("Weapon quantity (SIPRI trend-indicator value)")