Click the Original, Code and Reconstruction tabs to read about the issues and how they were fixed.
Objective
The data visualization aims to make people aware of most frequent methods of suicides in Netherlands. It also shows what are the most common age groups committing suicides. This is a grim issue and it can help government in preventing suicides and providing mental help to people showing signs of depression.
The chosen visualisation had the following three main issues:
Reference
The following code was used to fix the issues identified in the original.
## Loading required libraries for loading data and creating visualization
library(ggplot2)
library(readxl)
## Reading Data
Suicides_data <- read_excel("Suicides_data.xlsx")
## Converting age groups to ordered factors - ordered from youngest to oldest
Suicides_data$age_group_in_years <- factor(Suicides_data$age_group_in_years,
levels = c('< 20', '20 - 29', '30 - 39',
'40 - 49', '50 - 59', '60 - 69',
'70 - 79', '>= 80'),
ordered = TRUE)
## Creating the plot
plot <- ggplot(data = Suicides_data, aes(x = reorder(method, -suicides), y = suicides,
fill = age_group_in_years))
## Adding color scheme to bar bar plot
plot <- plot + geom_col(position = 'dodge') + scale_fill_brewer()
## positioning color legend and tilting the x-axis labels for clearity
plot <- plot + theme(legend.position="top", axis.text.x = element_text(angle = 45, hjust = 1),
plot.title = element_text(hjust = 0.5))
## Giving a title to plot and axes
plot <- plot + labs(title="Methods of suicide in Netherlands (2017)", x ="Method of suicide", y = "Number of suicides")
Data Reference
The following plot fixes the main issues in the original plot.