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

Update examples with tidyverse workflow #3

Open
jcpsantiago opened this issue Mar 21, 2017 · 4 comments
Open

Update examples with tidyverse workflow #3

jcpsantiago opened this issue Mar 21, 2017 · 4 comments

Comments

@jcpsantiago
Copy link

Just found this tasty package! Just what I needed to plot my hypnograms. Are you still using this package? If so, could you some examples using tidyverse techniques? Using them would make gglasagna even tastier I'm sure.

I was planning on creating a new geom to plot hypnograms, but this looks much better.

@swihart
Copy link
Owner

swihart commented Apr 3, 2017

I'm interested in looking into this -- can you post your favorite tidyverse tutorials/examples so I can get a feel for them and what's involved?

@jcpsantiago
Copy link
Author

The best IMO are the ones from Hadley himself https://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html

The critical thing is having the data in what Hadley calls "tidy" i.e. per observation and not per subject. This is how I have my own hypnogram data, so it's not so straight forward to use your plot. I'll look at the code later when I have time, because I would really like to use this in my upcoming paper.

@swihart
Copy link
Owner

swihart commented Apr 4, 2017

That makes sense. TBH, my coding for lasagna plots started with a wrapper for the base image(), which took a matrix -- it was only later I attempted a ggplot version. Let me give this a little more thought, as I agree that having gglasagna be compliant with the tidyverse philosophy is probably a worthwhile set of edits.

@jcpsantiago
Copy link
Author

jcpsantiago commented Apr 5, 2017

What about writing a geom_lasagna first and then a ggplot wrapper with a simple theme ("gglasagna")?

Probably the easiest way is to piggyback on a stacked geom_bar, minus the stacking.

I'm able to recreate your grouped lasagna plots with a stacked bar plot and the subject per row ones with geom_tile. They don't look as nice as yours though. It would be nice to have every 30sec block as a square. Anyway I digress..

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