Demonstrating the round bias (preference for multiples of 5 or 10) by respondents in the Stack Overflow Annual Developer Survey 2024
#TidyTuesday
Author
Aditya Dahiya
Published
September 1, 2024
How I made this graphic?
Loading libraries & data
Code
# Data Import and Wrangling Toolslibrary(tidyverse) # All things tidy# Final plot toolslibrary(scales) # Nice Scales for ggplot2library(fontawesome) # Icons display in ggplot2library(ggtext) # Markdown text support for ggplot2library(showtext) # Display fonts in ggplot2library(colorspace) # Lighten and Darken colourslibrary(seecolor) # To print and view colourslibrary(patchwork) # Combining plots# Option 2: Read directly from GitHub# qname_levels_single_response_crosswalk <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-09-03/qname_levels_single_response_crosswalk.csv')# stackoverflow_survey_questions <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-09-03/stackoverflow_survey_questions.csv')stackoverflow_survey_single_response <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2024/2024-09-03/stackoverflow_survey_single_response.csv')
Visualization Parameters
Code
# Font for titlesfont_add_google("Grenze Gotisch",family ="title_font") # Font for the captionfont_add_google("Barlow Condensed",family ="caption_font") # Font for plot textfont_add_google("Bellefair",family ="body_font") showtext_auto()bg_col <-"grey95"mypal <-c("grey40", "#D94801FF")text_col <-"grey20"text_hil <- text_colbts <-90# Caption stuff for the plotsysfonts::font_add(family ="Font Awesome 6 Brands",regular = here::here("docs", "Font Awesome 6 Brands-Regular-400.otf"))github <-""github_username <-"aditya-dahiya"xtwitter <-""xtwitter_username <-"@adityadahiyaias"social_caption_1 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{github};</span> <span style='color: {text_hil}'>{github_username} </span>")social_caption_2 <- glue::glue("<span style='font-family:\"Font Awesome 6 Brands\";'>{xtwitter};</span> <span style='color: {text_hil}'>{xtwitter_username}</span>")plot_title <-"Rounding Bias"plot_subtitle <- glue::glue("The Stack Overflow Annual Developer<br>Survey 2024 surveyed over 64,000<br>developers, and shows a good example of<br>Rouding Bias (or digit preference bias)<br>where respondents tend to round off<br>their answers to<b style='color:{mypal[2]}'> multiples of 5 or 10</b><br>for the number of years they<br>have spent coding.")plot_subtitle |>str_view()plot_caption <-paste0("**Data:** Havisha Khurana & Stack Overflow", " | **Code:** ", social_caption_1, " | **Graphics:** ", social_caption_2 )rm(github, github_username, xtwitter, xtwitter_username, social_caption_1, social_caption_2)