More figures, no excuses

After last week’s post about plotting figures, the lovely people of Twitter came forward with some more marvellous ideas about how I could plot the same data AND provided me with the code to do it. So here it is.

First, Tom Houslay (@tomhouslay) suggested plotting shoal means to show the idea that the data are in fact paired values:

CpbLzwNWAAAO5UxCpbL2ENWcAEQOih

Then, Mark Hill (@MarksHilly) suggested violin plots:

CpbttZ4WYAAIqI_

And finally Sarah Paul (@nonchalantnat) reminded me (because I saw them in her talk at ISBE) that she plotted boxplots with overlaid data. I had a go at doing those myself:

selfish herd replot3selfish herd replot3 code

So now I have ABSOLUTELY NO EXCUSES for shoddy #datavis in the future.

Advertisements

One thought on “More figures, no excuses

  1. Cool stuff! Interesting that the interaction between water and time (significant from the mixed model) only really becomes apparent from the data when looking at the level of shoals. To get at individual-level data, you could also plot individual lines and colour by shoals (here also using predictions from the mixed model). Because of the nature of the response variable (whole integers) then it looks a bit busy, but again I think including the paired nature of the data brings greater clarity to the biology:

    library(tidyr)

    df_nn %>%
    unite(col = “shoal_ind”,
    shoal, individual,
    remove = FALSE) %>%
    ggplot(., aes(x = Time, y = cohesion)) +
    geom_line(aes(group = shoal_ind,
    colour = factor(shoal)),
    alpha = 0.2) +
    geom_line(data = df_pred,
    aes(y = fit,
    group = water),
    size = 2) +
    scale_x_discrete(limits = c(“Before”,”After”)) +
    facet_grid(.~water) +
    theme_bw()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s