Labels always get misaligned
Opened this issue · 3 comments
Labels always get misaligned. They don't seem to follow any logical rule.
Using ggsankey on a W10 laptop with R version 4.2.1. Output was generated with pdf() since there is no proper antialiasing in the png() output (not an issue of ggsankey but of the OS), and some labels get cropped for being so far from the diagram.
The package is excellent however!
Hi! Can you provide the code and data for the graph?
Looks like you maybe be using hjust instead of nudge_x. But that’s just a guess!
Hi David, thanks for your prompt response. Your guess is totally correct. As a rookie I used an example from:
https://rpubs.com/techanswers88/sankey-with-own-data-in-ggplot
and for some reason it uses:
pl <- pl +geom_sankey_label(size = 3, color = "black", fill= "white", hjust = -0.5)
I then tried:
- Removing the hjust parameter and the labels are centred by default
- hjust=0 and the labels are aligned on the left (which I like best)
Will investigate what nudge_x is about.
Thanks!