Feature request - test for text self-overlap on sharp contours
seanhardison1 opened this issue · 1 comments
Hello! Thank you for creating an excellent package.
I would like to label contours on a DEM using geom_textcontour()
, but I've noticed that when there are sharp corners in the contours, the labels tend to overlap with themselves. It would be great if the package could test for these overlaps and adjust text placement to flatter regions along the contour (avoiding changing text size). It would also be helpful if we could exclude certain labels, even if the lengths of the labels are less than the lengths of their associated paths.
Here's a .csv for reproducing my issue
hp_dem_df <- read.csv(file = "hp_dem.csv")
library(ggplot2)
library(geomtextpath)
ggplot(hp_dem_df,
aes(y = latitude, x = longitude, z = fill_var)) +
geom_contour_filled() +
geom_textcontour()
Thank you!!!
Thank you Sean for your suggestion. A similar suggestion was raised in #86 and in the spirit of keeping the conversation about this feature in one place, I'll close this one in favour of #86. Currently, I have no idea how to do this efficiently, so I wouldn't count on this being implemented soon (if at all). In the meantime, for your particular plot, I'd have a look at the hjust = "auto"
setting as described here.