Skip to content

Instantly share code, notes, and snippets.

@timriffe
Created March 20, 2025 17:37
Show Gist options
  • Save timriffe/78c0101b3d67e3f62cee6d3fa0735f40 to your computer and use it in GitHub Desktop.
Save timriffe/78c0101b3d67e3f62cee6d3fa0735f40 to your computer and use it in GitHub Desktop.
A script to make Fig 1 for Antia Dominguez and Yolanda Gonzalez (2024) Self-rated health, time of residence and social determinants of health in immigrant populations: A complex relationship in groups of different origins in a Southern European region. Journal of Migration and Health, DOI: https://doi.org/10.1016/j.jmh.2024.100216
# download Excel from here:
# https://docs.google.com/spreadsheets/d/1zJPZ9uu6NpYruV8utJ-Cby4BGMpHw4XE/edit?usp=sharing&ouid=107044799582363262397&rtpof=true&sd=true
library(tidyverse)
library(readxl)
library(colorspace)
dat <- read_excel("Data/graficos_prev_ratio_antia_yolanda.xlsx", sheet = "table")
p <-
dat %>%
ggplot(aes(y = origen,
x = Valor,
group = interaction(origen, model),
color = model,
shape = model)) +
geom_vline(data = NULL,aes(xintercept = 1), col = gray(.5))+
geom_point(position = position_dodge2(width = .4, reverse = TRUE), size = 4) +
scale_x_log10(breaks = c(.8,1.25,2,4)) +
geom_pointrange(aes(xmin = lower, xmax = upper),
position = position_dodge2(width = .4, reverse = TRUE)) +
ylab("") +
xlab("log prevalence ratio") +
theme_minimal() +
theme(axis.text = element_text(size=14),
axis.title = element_text(size=16)) +
scale_color_discrete_qualitative()
p
ggsave("Figures/prevratio.svg",p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment