按组的gganimate树图在R中存在渲染问题

问题描述

我想创建一个gif,在geom_treemap显示推文文本,我正通过gganimate对这些树形图的过渡进行计时。数据是根据日期进行分组的,但是转换似乎错过了这个分组因素,并且它会在每个转换中继续添加文本,而不是为每个日期提供刷新的树形图。数据,代码和gif如下提供。

A)数据

    structure(list(date = structure(c(18552,18552,18553,18554,18555,18556,18557,18557),class = "Date"),user = c("bc670ht","DelVeneto","JMLudes","fmch6444","_ReaalAmerican_","andrenaleen","VintageloverH","semperdiced","fouririshlads","hahnalytics","mackinnom_kari","BasilNSybil","Neffinger","SGFilmComposer","o2bnobx","courageousgirl2","BlueGirlsRule","john_sipher","tariqpanja","ted_rood","InTheNoosphere","marchForTruth17","AngelaZiegenfe1","jean_mumford","azlibertad","JJohnsonLaw","IAmJoeTrudeau","biannaGolodryga","JamesFourM","Politics_PR","Sundae_Gurl","Not_PaulRevere","RWTrollPatrol","ProfessorCrunk","jilevin","harveyjkaye","drewmckevitt","ranger2911","gerardobarrios","CharlesLEllis4","Votevets"
),text = c("RT @bc670ht: No,There Isn’t Evidence That Trump Owes Money to Russia t.co/hzSHqHJDH0","RT @DelVeneto: t.co/entXcVtqKM","RT @JMLudes: @atrupar Literally from the Russian playbook. t.co/KHyR9lG9bV","RT @fmch6444: @EvanMcMullin @Asharangappa_ This is how they do it t.co/iKLbt3vFUZ","RT @_ReaalAmerican_: @MariaBartiromo @SenRonJohnson @FoxNews @SundayFutures t.co/KxhpQCAUMa","RT @andrenaleen: @daveweigel @HeerJeet Gee,I wonder where they get this idea.\n\nt.co/Jrev6FO8Zu","RT @VintageloverH: @angrierWHStaff As discussed here: t.co/URrZwfcEY9","RT @semperdiced: t.co/t6fquynxSO","RT @fouririshlads: @JoyceWhiteVance t.co/fZ1CB07OOS","RT @fmch6444: @clearing_fog Ah ha! I knew I read it somewhere!\nt.co/6nZgV5ja6M","RT @hahnalytics: @OreoBuffy5 @katie_robertson @brianstelter yup. putin playbook.\n\nt.co/eExN4w5oVG","RT @mackinnom_kari: @atrupar Of course he does. It’s right on schedule. \n\nt.co/UmbuvPe8WZ","RT @BasilNSybil: @waltshaub @SenRonJohnson StandArd Putin play\nt.co/zDCIJAMLhu","RT @Neffinger: @brookeSingman @DNI_Ratcliffe @AdamSchiff t.co/dOe0VDPgWf","RT @SGFilmComposer: @TheRickyDavila Foes of Russia Say Child Pornography Is Planted to Ruin Them t.co/eTkY0xD2iP","RT @o2bnobx: @RVAwonk @goldengateblond Weird how there’s a pattern... t.co/ExrW1VDAge","RT @courageousgirl2: Trump and Miss Moscow: Report examines Possible Compromises in Russia Trips t.co/HrCTRppm4P","RT @BlueGirlsRule: 2/2020 \n\nLawmakers are warned Russia is interfering in US elections\nt.co/0Dbdy6VLtp\n\n3/2020","RT @john_sipher: They just can’t help themselves.  t.co/9qwHrteO3U","RT @tariqpanja: Russia Got Caught Doping at the Olympics,Now They've Got Caught Hacking Them\n\nt.co/BxYT7AlNRC","RT @ted_rood: Is the Trump Campaign Colluding With Russia Again? t.co/T9v1IU8am7","RT @InTheNoosphere: Is the Trump Campaign Colluding With Russia Again? t.co/0X4B6CvNaE","RT @marchForTruth17: Is the Trump Campaign Colluding With Russia Again? -@michelleinbklyn t.co/9HsAFkD3D5","RT @AngelaZiegenfe1: Spoiler Alert: YES\n\nIs the Trump Campaign Colluding With Russia Again? t.co/U9aFaimKFP","RT @jean_mumford: @meiselasb NYTimes ?\n\nNow do ....\nRussia \n&\nSaudi arabia","RT @azlibertad: Opinion | Is the Trump Campaign Colluding With Russia Again? - The New York Times t.co/OPqU4nDAKt","RT @JJohnsonLaw: After Doping Scandal,Russia Hacked the Olympics,U.S. and Britain Say t.co/ULFS2SofLF","RT @IAmJoeTrudeau: Is the Trump Campaign Colluding With Russia Again? t.co/ioc2XjbUSM","RT @john_sipher: Russia is at war with us and our President is good with it.  t.co/QaqwUWFtYD","RT @biannaGolodryga: “Trump has been a godsend to Russia,”\n\nThis pretty much sums it up. \nt.co/O8Csql1hUa","RT @john_sipher: Funny. Russia again.  t.co/9qwHrteO3U","RT @JamesFourM: A reminder:\n\nFoes of Russia Say Child Pornography Is Planted to Ruin Them t.co/TWZtQmsC4M","RT @Politics_PR: U.S. Government and Tech Firms Push Back on Russia (and Trump) t.co/qhfUmSXPzC t.co/tpyYcw0me3","RT @Sundae_Gurl: @nytimes Sounds like Russia.","RT @Not_PaulRevere: @robertjdenault Much better reporting than when they front paged this: t.co/G2IxiJwCQv","RT @RWTrollPatrol: @DonaldJTrumpJr Is the Trump administration colluding with Russia again? \nt.co/6ZEQ4v1KsU","RT @ProfessorCrunk: Latino gender gap. Latino dudes support Trump at 47%. That shit cray. t.co/14mnoG6Cjk","RT @jilevin: Iran and Russia Seek to Influence Election in Final Days,U.S. Officials Warn t.co/EajRkWWUbf","RT @jilevin: U.S. Still Unsure of Havana Syndrome's Cause Years Later t.co/ydfo9j818u","RT @harveyjkaye: via @NYTimes t.co/WquA0H9Ajf","RT @drewmckevitt: Weird how this is also Republican election strategy t.co/LaqB0kOISb t.co/r87LoIuOfu","RT @ranger2911: @DonaldJTrumpJr t.co/1rqRxvKFQo","RT @gerardobarrios: @meiselasb Where was the press conference for Russian interference to help Trump? t.co/ozBliweUbJ","RT @CharlesLEllis4: @Yamiche Iran and Russia obtained Voter registration data?!?! You don't say!\nt.co/fD4Cy6Bo8l","RT @Votevets: Were these Marines victims of Russian bounties??! ?\n\nt.co/COLVTaeQpR"
),V1 = c(1L,1L,155L,70L,29L,17L,13L,8L,7L,6L,5L,9L,4L,3L,34L,18L,15L,14L,10L,109L,52L,40L,37L,30L,2L,2L)),row.names = c(NA,-52L),groups = structure(list(date = structure(c(18552,.rows = structure(list(
    1:2,3:12,13:22,23:32,33:42,43:52),ptype = integer(0),class = c("vctrs_list_of","vctrs_vctr","list"))),6L),class = c("tbl_df","tbl","data.frame"),.drop = TRUE),class = c("grouped_df","tbl_df","data.frame"))

请注意上述数据,因为我在发布此问题时不接受数据,所以我已从文本中删除https://

B)代码

t <- ggplot(t7b4,aes(area = V1,fill = user,label = user)) + 
  geom_treemap() + 
  geom_treemap_text(place = "centre",grow = T,reflow = T,colour = "dark blue",min.size = 0) +
  transition_reveal(date) +
  ease_aes('linear') +
  theme(legend.position = 'none') +
  labs(title = "Tweets: {frame_along}")

animate(t,length(unique(t7b4$date)),.4,width = 1000,height = 600)

C)gif图

See Animation

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...