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

Make the plots more jittery? #404

Open
giladfeldman opened this issue May 31, 2024 · 2 comments
Open

Make the plots more jittery? #404

giladfeldman opened this issue May 31, 2024 · 2 comments

Comments

@giladfeldman
Copy link

giladfeldman commented May 31, 2024

Hi,

JAMOVI creates some great plots, but some of those with the dots just look like they're on a line.

I'm guessing there's something that I can do to make those dots jitter more with ggplot2?
Any help or guidance would be appreciated.

Example:
3-reasons-mixed-anova

The code that creates this plot:

jmv::anovaRM(
    data = s2plot,
    rm = list(
        list(
            label="Reasons",
            levels=c("Waste", "Emotions", "Value", "Past"))),
    rmCells = list(
        list(
            measure="study2_reason_min_waste",
            cell="Waste"),
        list(
            measure="study2_reason_min_neg_emo",
            cell="Emotions"),
        list(
            measure="study2_reason_max_value",
            cell="Value"),
        list(
            measure="study2_reason_consistent_previous",
            cell="Past")),
    bs = Condition,
    effectSize = c("eta", "partEta"),
    depLabel = "Importance",
    rmTerms = ~ Reasons,
    bsTerms = ~ Condition,
    spherTests = TRUE,
    spherCorr = c("GG", "HF"),
    postHoc = list(
        c("Reasons", "Condition"),
        "Reasons"),
    emMeans = ~ Reasons + Condition + Reasons:Condition,
    emmTables = TRUE,
    emmPlotData = TRUE)

How might I tweak that?
I tried looking at s2plotjmv$emm[[3]]$emmPlot$plot but wasn't sure what kind of plot that is. Doesn't look like a ggplot2 I could add "+ geom_jitter()" to, is it?

Not a must and not a big deal, but can maybe add an argument to the JMV functions resulting in plots, or add something to the documentation. And, for those using this package in JAMOVI, maybe even an option to play around with things like the jitter (height/width/etc.)

@raviselker
Copy link
Member

Hi!

You can have access to the ggplot2 object through the s2plotjmv$emm[[3]]$emmPlot$plot$fun() function, so if you assign this to a variable than you should be able to use it as any other ggplot2 object.

However, though it's easy to adjust some theming this way, it's probably a lot harder to change an already created geom within the plot so not sure how you would change the jitter this way.

@giladfeldman
Copy link
Author

Hi Ravi, thank you. Learned something new about extracting the ggplot2 object from jmv, but yeah, you're right, can't jitter it that way, unfortunately.

JAMOVI team:
Might it be possible to add to JMV functions a way of tweaking the plots with an argument so that we can add better jitter?

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