corybrunson / ggalluvial

ggplot2 extension for alluvial plots
http://corybrunson.github.io/ggalluvial/
GNU General Public License v3.0
499 stars 34 forks source link

Variable distance between categories: add examples #33

Closed KGillinder closed 5 years ago

KGillinder commented 5 years ago

It would be great if there was an ability to adjust the horizontal distance between categorical axes, particularly for time-based plots? Because the time between data points is not always 'equal' and it would be great to have this proportional too.

corybrunson commented 5 years ago

I'm sorry for not replying to this sooner! Somehow it dropped off my radar.

This requires some sort of adjustment to scale_x_discrete(), which i haven't seen done anywhere. It might be discouraged by the philosophy of ggplot2. Have you seen other plots that customize the positions of discrete axis coordinates?

I believe the alluvial package can do this, and the parallel sets geom in the ggforce package might also. There are also more basic geom layers, intended for continuous rather than categorical data, that might suit you, including geom_area().

corybrunson commented 5 years ago

Correction: I was working on the assumption that your horizontal coordinates come from a discrete variable. If they come instead from a continuous variable, then what you're describing is the default behavior. See the example using the Refugees data in the ggalluvial vignette for an illustration. (Note: In this specific example, the continuous variable takes consecutive integer values, so the difference in behavior is not obvious.)

corybrunson commented 5 years ago

@KGillinder have you been able to try this out? Please let me know if you have any problems with it! I'll make a point to include some examples of this behavior in the next version; i'm re-titling the issue to make this clear to myself.

corybrunson commented 5 years ago

@KGillinder a new example in the stat_alluvium() documentation illustrates the idea with a continuous x variable. I'll close this issue a bit later, once the upgrade to v0.10.0 is on CRAN, but if this doesn't address your concern then please do elaborate! Thanks for the suggestion.

KGillinder commented 5 years ago

Hi Cory,

Apologies. I haven’t had a chance to test this out as yet. I will update you ASAP. Thanks for listening!

Sent from my iPhone

On 3 Sep 2019, at 9:42 pm, Cory Brunson notifications@github.com<mailto:notifications@github.com> wrote:

@KGillinderhttps://github.com/KGillinder a new example in the stat_alluvium() documentationhttp://corybrunson.github.io/ggalluvial/reference/stat_alluvium.html illustrates the idea with a continuous x variable. I'll close this issue a bit later, once the upgrade to v0.10.0 is on CRAN, but if this doesn't address your concern then please do elaborate! Thanks for the suggestion.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/corybrunson/ggalluvial/issues/33?email_source=notifications&email_token=AD6CA3HGGYHE6IA2O5VY77DQHZERZA5CNFSM4ID42BZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5X5KKA#issuecomment-527422760, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AD6CA3GBV5AR4EBLZQAVHY3QHZERZANCNFSM4ID42BZA.

corybrunson commented 5 years ago

No problem! If what's there suits you, then feel free to close the issue.

KGillinder commented 5 years ago

Hi Cory,

This is perfect and is working beautifully. Thank you.

corybrunson commented 5 years ago

Great! Thanks again for the prompt.