dados = read_csv(
    here::here("data/participation-per-country.csv"),
    col_types = cols(
        .default = col_double(),
        site = col_character(),
        country = col_character(),
        geo = col_character(),
        four_regions = col_character(),
        eight_regions = col_character(),
        six_regions = col_character(),
        `World bank income group 2017` = col_character()
    )
) %>% 
    filter(usuarios > 200)
glimpse(dados)
## Observations: 121
## Variables: 21
## $ site                           <chr> "StackOverflow", "StackOverflow",…
## $ country                        <chr> "Argentina", "Australia", "Austri…
## $ PDI                            <dbl> 49, 36, 11, 80, 65, 69, 70, 39, 6…
## $ IDV                            <dbl> 46, 90, 55, 20, 75, 38, 30, 80, 2…
## $ MAS                            <dbl> 56, 61, 79, 55, 54, 49, 40, 52, 2…
## $ UAI                            <dbl> 86, 51, 70, 60, 94, 76, 85, 48, 8…
## $ usuarios                       <dbl> 2798, 12313, 2518, 2558, 4275, 10…
## $ responderam_prop               <dbl> 0.5357398, 0.6133355, 0.6310564, …
## $ perguntaram_prop               <dbl> 0.5210865, 0.5897832, 0.5933280, …
## $ editaram_prop                  <dbl> 0.09256612, 0.14699911, 0.1493248…
## $ comentaram_prop                <dbl> 0.25339528, 0.33395598, 0.3502780…
## $ GNI                            <dbl> NA, 59570, 48160, 840, 44990, 116…
## $ Internet                       <dbl> 51.0, 79.5, 79.8, 5.0, 78.0, 45.0…
## $ EPI                            <dbl> 59.02, NA, 63.21, NA, 61.21, 49.9…
## $ geo                            <chr> "arg", "aus", "aut", "bgd", "bel"…
## $ four_regions                   <chr> "americas", "asia", "europe", "as…
## $ eight_regions                  <chr> "america_south", "east_asia_pacif…
## $ six_regions                    <chr> "america", "east_asia_pacific", "…
## $ Latitude                       <dbl> -34.00000, -25.00000, 47.33333, 2…
## $ Longitude                      <dbl> -64.00000, 135.00000, 13.33333, 9…
## $ `World bank income group 2017` <chr> "Upper middle income", "High inco…

Estamos interessados na relação entre quanto as pessoas de diferentes países comentam em questões dos outros. A proporção das pessoas do país que comentou nas questões de outros está medido na variável comentaram_prop.

Considerando essa variável, queremos examinar a relação entre ela e o quão hierárquicas são as relações em um país (PDI). Queremos também levar em conta o quanto as pessoas daquele país têm acesso à Internet (Internet) e qual o tamanho da base de dados que detectamos daquele país (usuarios).

Examinando essa relação

Faça uma visualização que usa os princípios de eficácia no projeto de visualizações para facilitar as comparações que você acha que são as mais importantes para entendermos esse contexto.

dados %>% 
    ggplot(aes(x = PDI, y = comentaram_prop, color = site)) + 
    geom_point() +
    #theme(axis.text.x = element_text(angle = 90)) +
    labs(x = "PDI", 
        y = "Proporção",
        color = "País")

dados %>%
    ggplot(aes(
        x = PDI,
        y = comentaram_prop,
        color = site,
        size = log10(usuarios)
    )) +
    geom_point(alpha = .6) + 
    #theme(axis.text.x = element_text(angle = 90)) +
    labs(x = "PDI", 
       y = "Proporção",
       color = "Site",
       size = "Usuários")

dados %>%
   filter(!is.na(IDV), !is.na(comentaram_prop), !is.na(Internet), !is.na(usuarios)) %>%
    ggplot(aes(
        x = PDI,
        y = comentaram_prop,
        color = log10(usuarios),
        size = Internet
    )) +
    geom_point(alpha = .6) + 
    facet_grid(site ~ ., scales = "free_y") +
    #theme(axis.text.x = element_text(angle = 90)) +
    labs(x = "PDI", 
       y = "Proporção",
       color = "Usuários",
       size = "Internet")

so = dados %>% 
    filter(site == "StackOverflow") %>% 
    sample_n(25)

so %>%
    ggplot(aes(
        x = country,
        size = comentaram_prop,
        y = comentaram_prop,
        color = comentaram_prop
    )) +
    geom_point(alpha = .3) + 
    coord_flip() + 
    #theme(axis.text.x = element_text(angle = 90)) +
    labs(x = "Proporção", 
       y = "País",
       color = "Proporção",
       size = "Proporção")

Outras formas de ver

Em seguida, faça 5 visualizações que usem as mesmas variáveis e também pontos, mas que sejam menos eficazes que a que você escolheu acima.

stackoverflow <- dados %>%
    select(site, country, comentaram_prop, PDI, Internet, usuarios) %>% 
    filter(site == "StackOverflow") %>%
        group_by(country, comentaram_prop) %>%
        arrange(comentaram_prop, .by_group = TRUE)

# estimativas_erros2 <- por_time %>%
#     select(ProjectCode, devs, estimativas, erro_medio_abs) %>% 
#         group_by(ProjectCode,erro_medio_abs) 

ggplot() +
    #geom_col(data = stackoverflow, mapping = aes(x = PDI , y = comentaram_prop)) +
   geom_point(data = stackoverflow, mapping = aes(x = country , y = comentaram_prop)) +
  #geom_point(data = stackoverflow, mapping = aes(x = comentaram_prop , y = country)) +
    
    # geom_line(data = estimativas_erros2, mapping = aes(x = ProjectCode , y=erro_medio_abs, group = 1), , color = "salmon") +
    # geom_point(data = estimativas_erros2, mapping = aes(x = ProjectCode , y=erro_medio_abs, group = 1), color = "red") +
    
    # geom_hline(data = estimativas_erros1, aes(yintercept=mean(devs)), show.legend = FALSE, color = "blue") +
    
    theme(axis.text.x = element_text(angle = 90)) +
    #scale_y_continuous(breaks = seq(0,100,5)) +
    labs(title = "StackOverflow",
        x = "País", 
       y = "Proporção")

super_user <- dados %>%
    select(site, country, comentaram_prop, PDI, Internet, usuarios) %>% 
    filter(site == "SuperUser") %>%
        group_by(country, comentaram_prop) %>%
        arrange(comentaram_prop, .by_group = TRUE)

# estimativas_erros2 <- por_time %>%
#     select(ProjectCode, devs, estimativas, erro_medio_abs) %>% 
#         group_by(ProjectCode,erro_medio_abs) 

ggplot() +
    #geom_col(data = super_user, mapping = aes(x = PDI , y = comentaram_prop)) +
   geom_point(data = super_user, mapping = aes(x = country , y = comentaram_prop)) +
  #geom_point(data = super_user, mapping = aes(x = comentaram_prop , y = country)) +
    
    # geom_line(data = estimativas_erros2, mapping = aes(x = ProjectCode , y=erro_medio_abs, group = 1), , color = "salmon") +
    # geom_point(data = estimativas_erros2, mapping = aes(x = ProjectCode , y=erro_medio_abs, group = 1), color = "red") +
    
    # geom_hline(data = estimativas_erros1, aes(yintercept=mean(devs)), show.legend = FALSE, color = "blue") +
    
    theme(axis.text.x = element_text(angle = 90)) +
    #scale_y_continuous(breaks = seq(0,100,5)) +
    labs(title = "SuperUser",
        x = "País", 
       y = "Proporção")

Bônus

Inclua o continente dos países (six_regions) na visualização.

so %>%
    filter(!is.na(six_regions)) %>%
    ggplot(aes(
        x = country,
        y = comentaram_prop,
        color = six_regions
    )) +
    geom_point(size = 3) + 
    coord_flip() + 
    #theme(axis.text.x = element_text(angle = 90)) +
    labs(x = "Proporção", 
       y = "País",
       color = "Região")