Good Data Institute
2024-02-05
Data Visualisation → Communicating insights truthfully and with beauty
Truthfully – Representing data accurately and without bias; avoiding misleading visualisations
Beauty – Making data engaging, emphasize key points, and tell a story. Provide context and make it easy to understand
::: {.notes}cli This is an example of a data visualisation that shows the impact of climate change on conflict around the world. The visualisation uses color, size, and position to show the relationship between climate change and conflict. The data is presented in a way that is engaging and easy to understand, making it more likely that people will pay attention and remember the key points. :::
\[ P(\text{Dark}) \lt P(\text{Light}) \]
\[ P(\text{Dark} \cap \text{Male}) \lt P(\text{Dark} \cap \text{Female}) \lt \\ P(\text{Light} \cap \text{Female}) \lt P(\text{Light} \cap \text{Male}) \]
SQL
query to download all project data and write to csvRows: 1
Columns: 6
$ project_id <int> 29
$ project_name <chr> "Biden-Harris Transition DEI"
$ charity_name <chr> "Inclusive America"
$ hq_country <chr> "United States"
$ hq_city <chr> "Washington DC"
$ gdi_branch <chr> "Melbourne"
# A tibble: 9 × 2
hq_country n
<chr> <int>
1 Australia 35
2 India 1
3 New Zealand 23
4 Spain 2
5 Taiwan 1
6 Thailand 1
7 Uganda 2
8 United Kingdom 3
9 United States 12
Question: Whats missing for both?
What might this visualisation struggle to communicate?
<5%
of the world’s scientific research
Design
Test
Evaluate
infrastructure_as_code.(Terraform) == Good
library(maps)
# Map data preparation with country name adjustments
d_projects <- d_projects %>%
mutate(hq_country = case_when(
hq_country == "United States" ~ "USA",
hq_country == "United Kingdom" ~ "UK",
TRUE ~ hq_country
))
# Load world map data
world_map <- map_data("world")
# Join your project data and prepare the map data
map_data <- world_map %>%
left_join(d_projects %>%
count(hq_country, name = "n_projects"), by = c("region" = "hq_country")) %>%
replace_na(list(n_projects = NA))
# Plotting the map
ggplot(map_data, aes(x = long, y = lat, group = group, fill = n_projects)) +
geom_polygon(color = "#1C1C1C", size = 0.15) + # Adjust border color for better visibility on dark background
scale_fill_gradient(low = "lightblue", high = "darkblue", name = "Number of Projects", na.value = "#313131") +
labs(title = "Number of Projects by Headquarters Country", x = "", y = "") +
theme_void() +
theme(
text = element_text(color = "white"), # Changes text color to white
plot.background = element_rect(fill = "black", color = NA), # Dark plot background
panel.background = element_rect(fill = "black", color = NA), # Dark panel background
panel.grid.major = element_blank(), # Adjust grid color and size
panel.grid.minor = element_blank(), # No minor grid
plot.title = element_text(color = "white", hjust = 0.5), # Title in white and centered
axis.text = element_blank(), # Remove axis text
axis.ticks = element_blank(), # Remove axis ticks
legend.background = element_rect(fill = "black", color = NA), # Dark legend background
legend.text = element_text(color = "white") # White legend text
)