Hi,
I've been trying to find a way how to make (only) my 'Česká rep.' bold yet unsuccessfuly. Do you have any suggestions?
data_wide <- structure(list(Country = c("Greece", "Lithuania", "Finland",
"Estonia", "Croatia", "Netherlands", "France", "Denmark", "Portugal",
"Belgium", "Luxembourg", "Hungary", "Germany", "Slovakia", "Austria",
"Sweden", "Czechia", "Ireland", "Romania", "Italy", "Slovenia",
"Spain", "Bulgaria", "Poland", "Latvia"),
CZE = structure(c(25L, 24L, 23L, 22L, 21L, 20L, 19L, 17L, 18L, 15L, 16L, 14L, 13L, 12L,
11L, 10L, 8L, 9L, 7L, 6L, 5L, 4L, 3L, 2L, 1L),
levels = c("Lotyšsko", "Polsko", "Bulharsko", "Španělsko", "Slovinsko", "Itálie",
"Rumunsko", "Česká rep.", "Irsko", "Švédsko", "Rakousko",
"Slovensko", "Německo", "Maďarsko", "Belgie", "Lucembursko",
"Dánsko", "Portugalsko", "Francie", "Nizozemsko", "Chortvatsko",
"Estonsko", "Finsko", "Litva", "Řecko"), class = "factor"),
`2009` = c(8.3, 13.1, 10, 11.9, 11.1, 9.4, 12.6, 10.6, 11.5,
10.1, 11.9, 11.5, 11.2, 10.7, 11.8, 7.3, 12.1, 11, 11, 7.3,
10.5, 10, 10.5, 10.2, 9.9), `2019` = c(6.3, 11.1, 8.2, 10.4,
9.6, 8.2, 11.4, 9.5, 10.4, 9.2, 11, 10.7, 10.6, 10.3, 11.6,
7.1, 11.9, 10.8, 11, 7.7, 11.1, 10.7, 11.2, 11, 11.6),
rozdil = c(-2, -2, -1.8, -1.5, -1.5, -1.2, -1.2, -1.1, -1.1, -0.9, -0.9,
-0.800000000000001, -0.6, -0.399999999999999, -0.200000000000001,
-0.2, -0.199999999999999, -0.199999999999999, 0, 0.4, 0.6,
0.699999999999999, 0.699999999999999, 0.800000000000001, 1.7)),
row.names = c(NA, -25L), class = c("tbl_df", "tbl", "data.frame"))
library(tidyverse)
ggplot(data_wide, aes(x = rozdil, y = CZE)) +
geom_col(width = 0.9, fill = if_else(data_wide$CZE == "Česká rep.","#ECB925", "#00254B")) +
theme_minimal() +
theme(legend.position = 'none',
legend.margin=margin(0,0,0,0),
legend.title = element_blank(),
text = element_text(size = 15),
axis.text.x = element_text(size = 13),
axis.text.y = element_text(size = 13,
angle = 0,
hjust = 0.7,
face = ifelse(data_wide$CZE == "Česká rep.", "bold", "plain")),
axis.title.x = element_text(size = 11.5),
plot.margin = margin(10, 10, 10, 10),
axis.title.y = element_blank(),
panel.spacing = unit(2, "lines"),
panel.grid.major.y = element_blank()) +
scale_x_continuous(name = "změna ve spotřebě alkoholu mezi lety 2009 a 2019",
label = scales::comma_format(accuracy = 1, scale = 1, prefix = "", suffix = "",
big.mark = " ", decimal.mark = ","))
#> Warning: Vectorized input to `element_text()` is not officially supported.
#> ℹ Results may be unexpected or may change in future versions of ggplot2.
Many thanks!