Skip to content

BUG: Tweening converts some text labels to hex codes, fails when combined with other text #508

Description

@katrinabrock

Issue trigger

Create an animation with an impacted text string as the label, for example 0 pi.

Expected behavior

This labels shows up both in main plots and transitional frames.

Actual behavior

Either the plot totally fails to render, with the error Error: The labelcolumn differs in type between the two inputs or transitional frames are labeled with #FFFFFF00.

MRE

anim_save(
  'example.gif',
  ggplot(aes(x=x,y=y,label=label), data = data.frame(
    label = '0 pi',
    x = 1:4,
    y = 1:4,
    frame = 1:4
  )) + geom_text() + transition_states(frame),
  nframes = 31,
  fps = 5
)

Results in:
example

anim_save(
  'example.gif',
  ggplot(aes(x=x,y=y,label=label), data = data.frame(
    label = c('0 pi', '0 pi', 'other', 'labels'),
    x = 1:4,
    y = 1:4,
    frame = 1:4
  )) + geom_text() + transition_states(frame),
  nframes = 31,
  fps = 5
)

Errors out with

Error : The labelcolumn differs in type between the two inputs

Likely from here: https://github.com/thomasp85/tweenr/blob/main/R/tween_state.R#L157

Exploring a little, the mis-match types are colour vs character, but not sure how this came to be.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions