stat_density_2d not reacting to coord_flip

A recent update seems to have changed how my plots work. The ggplot below
has worked for years. The heatmap generated by the stat_density_2d and teh geom_points were rotated 90 degrees by coord_flip. As of late only the geom_points rotate. I understand coord_flip is being removed but is there something obvious i am missing?

data %>%
ggplot() +
annotation_custom(full_pitchpng , xmin=-20, xmax=120, ymin=-2, ymax=70) +
xlim(-20,120) + ylim(-10,70) +
stat_density_2d(aes(x_coord_end, y_coord_end,fill = ..density.., alpha=..level..), geom = "raster", contour = FALSE, alpha = 0.5) +
scale_fill_distiller(palette="Spectral", direction=-1, guide=FALSE) +
geom_segment(aes(x = x_coord, y = y_coord, xend = x_coord_end, yend = y_coord_end),col = "deepskyblue") +
geom_point(aes(x = x_coord, y = y_coord), pch = 21, fill = "deepskyblue") +
geom_point(aes(x = x_coord_end, y = y_coord_end), pch = 21, fill = "firebrick4") +
coord_flip()

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.