Using ggpacket()
to create a function and I'd like to name a specific variable edtriage
that will be in the dataframe that gets named when using the function (different dataframes supplied each time).
I tried both date_breaks()
and breaks()
with the same issue. When I supplied the same variable name in geom_text, it worked through aes().
geom_gradient <- ggpacket() +
geom_link2(aes(group = 1), size = 3, show.legend = FALSE) + # Gradient line
geom_point ( size = 5 ) +
# Below naming always worked
geom_text_repel(aes(label = if_else(edtriage == max(edtriage), sprintf("%1.1f%%", Percent), "" )) , size = 15 ) +
scale_x_date(date_labels="%b\n%y",
breaks = seq(from = min(.$edtriage), to = max(.$edtriage), by = 0.25), # Not working
# breaks = seq(from = min(edtriage), to = max(edtriage), by = 0.25), # Not working either
date_minor_breaks = "1 month" ) +
theme_minimal()