piermorel / gramm

Gramm is a complete data visualization toolbox for Matlab. It provides an easy to use and high-level interface to produce publication-quality plots of complex data with varied statistical visualizations. Gramm is inspired by R's ggplot2 library.
MIT License
779 stars 221 forks source link

Connecting data points across repeated measures conditions #92

Open wildetudor opened 4 years ago

wildetudor commented 4 years ago

Dear Pier,

I have repeated measures data from subjects across multiple conditions, that I'd like to show as raw data points + boxplots. I am using a combination of g.stat_boxplot and g.geom_jitter for this.

I would also like to connect data points across these conditions, to help visually identify subjects. A bit like this: 20200114_163336

The only such functionality I found in gramm was the 'geom',{'line', 'lines'} argument of g.stat_summary. However, that just connects the means/error bars, not the actual data points.

I could easily manually draw the lines myself in a for loop, however adding content to a gramm figure (with update) seems rather difficult/unstable.

Are you able to help? Thank you so much!

Tudor

piermorel commented 4 years ago

Hi Tudor,

It's indeed kind of possible to do what you want with update() and providing your subjects as a 'group' variable in the update() call, and then using geom_line(). For now that is the only way I see do do that within gramm. However, it won't work well with geom_jitter() because geom_line() doesn't know about the jitter.

Let me know if that helps, but here we are at the limit of what is possible within gramm, especially since update() is a kind of hack that only works in certain cases.

wildetudor commented 4 years ago

Alright, thanks Pier, that's stil helpful, will try to see if I can do this somehow