About

About Me

This is Li Jiachen’s final project of Data Journalism.

Thank you for your time to read.

Statement on AI use

  1. In the first question about visualizing the bar chart, I asked AI Doubao “how to sort the bars from high to low”, AI gives me: fct_reorder(.f, .x, .fun = median, …, .desc = FALSE)

  2. In the third question, to label the pie chart with percentages, I asked AI Doubao “how to round without decimals to get the percentage value”, it gives me:

    percent_label <- paste0(round(proportion * 100), "%")
  3. In the third question, I asked “In ggplot2, how to center text labels in a pie chart”, it gives me:

    you can use the geom_text() function and adjust the horizontal and vertical alignments,

    example:

    ggplot(data, aes(x = ““, y = values, fill = category)) + geom_bar(stat =”identity”, width = 1) + coord_polar(theta = “y”) + geom_text(aes(label = category, y = values / 2), position = position_stack(vjust = 0.5), hjust = 0.5, vjust = 0.5) +

  4. In the last question, I asked “Why is the graph like this? The part of Hong Kong is not showing any color:

    ggplot(pie_df, aes(x = ““, y = count, fill = region, label = percentage)) +

    geom_bar(stat = “identity”) +

    coord_polar(“y”) +

    geom_text(position = position_stack(vjust = 0.5)) +

    labs(title = “Refugees Hosted in Hong Kong vs Global (2024)”, fill = “Region”) + scale_fill_manual(values = c(“Hong Kong” = “#D6EDE7”, “Rest of World” = “#A0D2C3”)) + theme_minimal()”

    It gives me: In geom_bar, add color = “white”, linewidth = 0.5 - even if the sector of Hong Kong is very small, the white border can outline its boundary, making it visually apparent (the corresponding color can be seen).