-
Notifications
You must be signed in to change notification settings - Fork 31
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
Comments
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: pl <- pl +geom_sankey_label(size = 3, color = "black", fill= "white", hjust = -0.5) I then tried:
Will investigate what nudge_x is about. Thanks! |
Hi David, you already solved the question on GitHub. I have two more questions:
* Categories are alphabetically ordered by default down-to-up. Is is it possilble to orden them up-to-down? (i.e. "1_GROUP" would be plotted above "2_GROUP", not below). Or better even: use a vector to set the ordering for all categories.
* Second question: the ggsankey plotting works with dataframes where each row is one sample. Is it possible to adapt it to work with already calculated input/output matrix?
For instance: this dataframe
Before After
G1 G2
G1 G3
G2 G1
G1 G2
G2 G2
G3 G1
Can be defined with a Before/Afer matrix so that all repetated transitions (like G1 -> G2) don't need to be repeated, just counted:
[
[0 2 1]
[1 1 0]
[1 0 0]
]
This can save tons of space and processing when the equivalent dataframe has thousand of rows.
I'm applying a workaround to compensate for the absence of antialiasing in the Windows output by outputting to PDF and then converting to PNG. The quality is superb!
Best regards
…________________________________
De: David Sjoberg ***@***.***>
Enviado: jueves, 24 de noviembre de 2022 20:04
Para: davidsjoberg/ggsankey ***@***.***>
Cc: Guillermo Luijk ***@***.***>; Author ***@***.***>
Asunto: Re: [davidsjoberg/ggsankey] Labels always get misaligned (Issue #30)
Can you provide the code and data for the indie?
—
Reply to this email directly, view it on GitHub<#30 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AK5GWJLAAHNL43P7HZ73J5LWJ635BANCNFSM6AAAAAASKVNPAQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
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!
The text was updated successfully, but these errors were encountered: