adding zigzag on y axis in ggplot inbetween two variables

388 Views Asked by At

I want to add a zigzag on the y-axis in ggplot in between to variables (one variable ranges between 25 and 35 and the other between 59 and 65). I tried to use break axis, but then I need to use plot instead of ggplot and I am not able to get the same graph in plot. Are there ways to add a zigzag in ggplot? Or how do I get the same graph in plot with the adding of break axis.

p11 <- ggplot(df18, aes(x=year, y=hba1c, shape = diabetes_class)) +
   geom_line(mapping= aes(x= df18$year, y = df18$hba1c, colour = "grey")) +
   geom_point(aes(x= rapportagejaar, y = hba1c, colour = "grey")) +
   geom_line(mapping = aes(x= year, y = df18$bmi, colour = "black")) + 
   geom_point(aes(x= year, y = bmi, colour = "black")) +
   labs(x='Year', y='Value', shape = "") +
   theme_classic() +
   scale_color_grey(name = "", labels = c("BMI","HbA1c")) +
   theme(text=element_text(size=10,  family="Arial"), legend.position = "top", axis.title.y.left = element_text(color = "black")) + 
   scale_y_continuous(limits = c(25,65), breaks = c(25,30,35,55,60,65))
0

There are 0 best solutions below