elpaco-escience / talkr

https://elpaco-escience.github.io/talkr/
Apache License 2.0
0 stars 0 forks source link

`geom_turn()` should sound a warning when attempting to plot multiple sources #79

Open mdingemanse opened 3 months ago

mdingemanse commented 3 months ago

Right now geom_turn() will merrily plot whatever you serve it. Whether it is a single source:

  dplyr::filter(source == "/dutch2/DVA9M") |>
  dplyr::filter(end < 60000) |>
  ggplot(aes(x = end, y = participant)) +
  geom_turn(aes(
    begin = begin,
    end = end)) +
  xlab("Time (ms)") +
  ylab("") +
  theme_turnPlot()

Or the whole dataset, merging things from multiple sources, which doesn't make sense:

data |>
  ggplot(aes(x = end, y = participant)) +
  geom_turn(aes(
    begin = begin,
    end = end)) +
  xlab("Time (ms)") +
  ylab("") +
  theme_turnPlot()

image

I think in a case like the latter, where multiple conversations risk being plotted over each other, geom_turn() should issue a warning:

Looks like you're trying to plot turns from multiple conversations. For better results, try to plot a single source, or facet by source.