Recreating gradient colored lines in R with ggforce's geom_link function (CC328)

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 7

  • @beatmoser1631
    @beatmoser1631 18 днів тому +1

    Thanks for the video!
    Wouldn't it be easier to plot a white space just before the geom_link (since this function does not properly deal with alpha = 1) like so:
    geom_segment(data = margins, linewidth = 2.8,
    mapping = aes(x = polling, xend = actual,
    y = state_index, yend = state_index),
    inherit.aes = F,
    alpha = 1,
    fill = "white",
    show.legend = FALSE) +
    This is a simple copy past from the subsequent geom_link. So we can get rid of the five annotate calls.
    As for the textbox we could simply add " fill = "white" (instead of transparent / NA) to avoid the respective annotation.

    • @Riffomonas
      @Riffomonas  17 днів тому

      Yeah - I thought I added a note in the video about adding a geom_segment behind the geom_link, but that would make things easier. I think we'd want to use color = "white" rather than fill

  • @zjardynliera-hood5609
    @zjardynliera-hood5609 18 днів тому

    I love ggtext for italicized taxon names.

    • @Riffomonas
      @Riffomonas  18 днів тому

      It's one of the many reasons I love ggtext. There's really no excuse to not italicize names or keep the "g__" prefix on the names 🤓

  • @PeperazziTube
    @PeperazziTube 18 днів тому

    The only thing bothering me about the graph is the ordering of states. I would order it by the actual result to get a nicer “flowing” appearance. It seems that the ordering is on the mean of polled and actual, which has no meaning at all.

    • @Riffomonas
      @Riffomonas  18 днів тому +1

      Interesting point! I'd still leave National at the top, but perhaps flip Wisconsin and Michigan. Thanks for watching 🤓