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

Symmetrical jitter & highlighting plot elements #79

Open
wildetudor opened this issue Jan 29, 2019 · 2 comments
Open

Symmetrical jitter & highlighting plot elements #79

wildetudor opened this issue Jan 29, 2019 · 2 comments

Comments

@wildetudor
Copy link

I very much hope this is the last time I bother you on here, Pierre. If I may, just a couple more questions:

  1. I have several data points at each of several quantised levels, and I'd like to plot these as a dot plot (before adding other layers on top). The MatlabExchange script I was using previously (Univarscatter) was plotting points situated at the same level equidistantly about a central x value, regardless of the jitter width:
    29-01-2019 16 10 49

Since I've now migrated all my plotting to gramm, I was hoping to obtain more or less the same with geom_jitter, but I get randomly non-equidistant points:
29-01-2019 16 24 01

Reducing the width doesn't help. Is there a way to make the jitter more systematic/symmetrical?

  1. On this scatter plot, I'd like to highlight certain data points by making the marker larger or of a different shape, as in the UnivarScatter plot above. Can this be done, either with gramm or in parallel to it?

  2. Similarly, I'd like to highlight the median on my violin plots. Adding stat_boxplot would be overkill - I'd like to just add a horizontal line (again, as in the plot above). Using Matlab commands ( line() ) prior to g.draw() seems to make a mess.

Thank you so much!

@piermorel
Copy link
Owner

Hi Tudor,

No bother ;) Though I'm afraid today won't be as useful.

  1. Actually here the answer is easy, but sad : gramm doesn't have this functionality... geom_jitter can only do a random jitter of the points.
    That said, since there is some existing file exchange code that does that (and it seems very well documented), it probably wouldn't be overly hard to add as a functionality to gramm as a new geom ! I might check it out myself, but you are welcome to try too... that might be faster !

  2. That's not an easy one for sure. It could be relatively easy to highlight a point by shape by adding a 'shape'argument to gramm as you would with color... but then the problem is that the point is considered separately by all functions (stat_, but also jitter). Using update() could maybe get around the issue for stat_ but that's not super satisfying.

  3. For the median line, stat_boxplot followed by a removal of the box seems to me like the easiest option sadly. Median display is part of stat_summary but it can't draw lines, just points...

@wildetudor
Copy link
Author

Thank you PIerre. It seems to me the best plotting solution (for someone who's not a Matlab pro) is to combine features from various functions, but unfortunately this is exactly what's challenging in this case, given gramm's class/objects which apparently don't easily interface with Matlab plots that are elseway produced.

I think for now I'll just do in gramm what can be done in gramm, and use 'old' methods for all else, rather than try and improve one by means of the other :)

Thanks again, I really appreciate it!!

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

No branches or pull requests

2 participants