inst/Paper/muell.R

ggplot(match4 %>%
         gather(donor,value,-country,-year) %>%
         filter(country == "Angola",
                donor %in% c("Germany",
                             "France")),
       aes(x = year,
           y = value)) +
  geom_point(aes(col = donor)) +
  geom_line(aes(col = donor)) +
  labs(title = "yearly mean vote distance from Angola")


# comp high wenn diese low

# UND comp high wenn general donor-donor distance big

x = 0.1
(x-1)*-1

dist_DON_DON = 0.2
dist_DON1 = 0.8
dist_DON2 = 0.3

dist_DON_DON * ((abs(dist_DON1-dist_DON2)-1)*-1)

by = 0.025

df <-
  expand.grid(dist_DON_DON = seq(0,1,by),
              dist_DON1 = seq(0,1,by),
              dist_DON2 = seq(0,1,by))

df2 <-
  df %>%
  mutate(dist_DONS_REP = ((abs(dist_DON1-dist_DON2)-1)*-1)) %>%
  mutate(value = dist_DON_DON * dist_DONS_REP) %>%
  select(-dist_DON1,-dist_DON2) %>%
  unique()

df2$value

library(rayshader)

gg <-
  ggplot(df2, aes(dist_DONS_REP, dist_DON_DON)) +
  geom_point(aes(col = value)) +
  geom_point(data = data.frame(dist_DONS_REP = 0.25,
                               dist_DON_DON = 0.25,
                               value ))
scale_color_viridis_c(option = "A")

#plot_gg(gg, width = 3.5, raytrace = FALSE, preview = TRUE)

plot_gg(gg,
        width = 3.5,
        windowsize = c(1600, 1600),
        height = 4,
        scale = 300,
        multicore = TRUE,
        fov = 70,
        zoom = 0.4,
        theta = 330,
        phi = 40)
render_snapshot(clear = TRUE)
LuMesserschmidt/UNPC documentation built on Nov. 25, 2019, 8:17 a.m.