Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels always get misaligned #30

Open
gluijk opened this issue Nov 24, 2022 · 3 comments
Open

Labels always get misaligned #30

gluijk opened this issue Nov 24, 2022 · 3 comments

Comments

@gluijk
Copy link

gluijk commented Nov 24, 2022

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!
ggsankey

@davidsjoberg
Copy link
Owner

davidsjoberg commented Nov 24, 2022

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!

@gluijk
Copy link
Author

gluijk commented Nov 25, 2022

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!

@gluijk
Copy link
Author

gluijk commented Nov 28, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants