加快transition_reveal以及其他一些相关问题

时间:2019-01-26 11:20:37

标签: r gganimate

我一直在与gganimate认真对待,试图创造一个有关印度各州素质指标的等级变动的故事。虽然我可以将动画制作到整个故事的某个水平,但仍然与整个图片相去甚远。

这是我到目前为止想出的 enter image description here

每个国家每个月的动画排名变动背后的数据如下

> dput(onlyrank)
structure(list(`Short name` = c("AP", "AP", "AP", "AP", "AP", 
"AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", 
"AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", "AP", 
"AP", "AP", "AP", "AP", "AS", "AS", "AS", "AS", "AS", "AS", "AS", 
"AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", 
"AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", "AS", 
"AS", "AS", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", 
"BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", 
"BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", "BR", 
"CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", 
"CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", 
"CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "CG", "DL", "DL", 
"DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", 
"DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", "DL", 
"DL", "DL", "DL", "DL", "DL", "DL", "DL", "GA", "GA", "GA", "GA", 
"GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", 
"GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", "GA", 
"GA", "GA", "GA", "GA", "GA", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", 
"GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", 
"GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", "GJ", 
"GJ", "GJ", "GJ", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", 
"HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", 
"HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", "HP", 
"HP", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", 
"HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", 
"HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "HR", "JH", 
"JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", 
"JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", 
"JH", "JH", "JH", "JH", "JH", "JH", "JH", "JH", "JM", "JM", "JM", 
"JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", 
"JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", "JM", 
"JM", "JM", "JM", "JM", "JM", "JM", "KA", "KA", "KA", "KA", "KA", 
"KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", 
"KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", "KA", 
"KA", "KA", "KA", "KA", "KL", "KL", "KL", "KL", "KL", "KL", "KL", 
"KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", 
"KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", "KL", 
"KL", "KL", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", 
"KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", 
"KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", "KO", 
"KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", 
"KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", 
"KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "KS", "MH", "MH", 
"MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", 
"MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", "MH", 
"MH", "MH", "MH", "MH", "MH", "MH", "MH", "MP", "MP", "MP", "MP", 
"MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", 
"MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", "MP", 
"MP", "MP", "MP", "MP", "MP", "MU", "MU", "MU", "MU", "MU", "MU", 
"MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", 
"MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", "MU", 
"MU", "MU", "MU", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", 
"NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", 
"NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", "NE", 
"NE", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", 
"OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", 
"OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "OR", "PJ", 
"PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", 
"PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", 
"PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "PJ", "RJ", "RJ", "RJ", 
"RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", 
"RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "RJ", 
"RJ", "RJ", "RJ", "RJ", "RJ", "RJ", "TE", "TE", "TE", "TE", "TE", 
"TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", 
"TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", "TE", 
"TE", "TE", "TE", "TE", "TN", "TN", "TN", "TN", "TN", "TN", "TN", 
"TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", 
"TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", "TN", 
"TN", "TN", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", 
"UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", 
"UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", "UA", 
"UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", 
"UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", 
"UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", 
"UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-E", "UP-W", 
"UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", 
"UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", 
"UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", 
"UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "UP-W", "WB", "WB", "WB", 
"WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", 
"WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", "WB", 
"WB", "WB", "WB", "WB", "WB", "WB"), Date = structure(c(17879, 
17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 
17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 
17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 
17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 
17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 
17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 
17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 
17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 
17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 
17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 
17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 
17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 
17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 
17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 
17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 
17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 
17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 
17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 
17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 
17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 
17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 
17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 
17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 
17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 
17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 
17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 
17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 
17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 
17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 
17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 
17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 
17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 
17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 
17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 
17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 
17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 
17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 
17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 
17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 
17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 
17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 
17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 
17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 
17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 
17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 
17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 
17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 
17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 
17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 
17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 
17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 
17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 
17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 
17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 
17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 
17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 
17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 
17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 
17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 
17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 
17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 
17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 
17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 
17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 
17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 
17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 
17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 
17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 
17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 
17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 
17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 
17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 
17908, 17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 
17886, 17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 
17895, 17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 
17904, 17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 
17882, 17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 
17891, 17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 
17900, 17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 
17909, 17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 
17887, 17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 
17896, 17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 
17905, 17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 
17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 
17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 
17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 
17879, 17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 
17888, 17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 
17897, 17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 
17906, 17907, 17908, 17909, 17879, 17880, 17881, 17882, 17883, 
17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891, 17892, 
17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900, 17901, 
17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909, 17879, 
17880, 17881, 17882, 17883, 17884, 17885, 17886, 17887, 17888, 
17889, 17890, 17891, 17892, 17893, 17894, 17895, 17896, 17897, 
17898, 17899, 17900, 17901, 17902, 17903, 17904, 17905, 17906, 
17907, 17908, 17909), class = "Date"), variable = structure(c(7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 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L, 8L, 7L, 9L, 13L, 8L, 14L, 12L, 14L, 3L, 11L, 6L, 4L, 
6L, 4L, 9L, 10L, 13L, NA, 8L, 9L, 10L, 9L, 26L, 24L, 22L, 24L, 
27L, 24L, 24L, 18L, 25L, 24L, 23L, 25L, 21L, 24L, 28L, NA, 26L, 
28L, 25L, 24L, 24L, 25L, 25L, 25L, 24L, 25L, 22L, 28L, 24L, 22L, 
22L, 28L, 28L, 26L, 27L, 26L, 27L, 27L, NA, NA, 26L, 28L, 23L, 
23L, 27L, 24L, 18L, 22L, 24L, 24L, 22L, 22L, 22L, 24L, 24L, 25L, 
23L, 21L, 26L, 23L, 25L, 24L, 19L, 19L, 16L, 25L, 21L, 21L, 19L, 
15L, 20L, 21L, 21L, 18L, 19L, 21L, 20L, NA, NA, 19L, 15L, 16L, 
15L, 16L, 15L, 13L, 19L, 18L, 15L, 18L, 18L, 17L, 19L, 17L, 18L, 
19L, 18L, 18L, 19L, 17L, NA, 17L, 19L, 19L, 19L, 17L, 19L, 19L, 
15L, 16L, 20L, 21L, 19L, NA, 21L, 19L, 21L, 22L, 20L, NA, 19L, 
20L, 20L, 18L, 25L, 27L, 24L, 19L, 19L, 25L, 23L, NA, 21L, 17L, 
24L, NA, NA, 25L, 26L, 19L, 24L, 27L, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, 27L, NA, NA, NA, 8L, 5L, 2L, 5L, 4L, 8L, 4L, 5L, 
11L, 11L, 12L, 14L, 10L, 13L, 17L, 8L, 12L, 13L, 7L, 13L, 8L, 
10L, 6L, 11L, 11L, 6L, 9L, 11L, 10L, 7L, 5L, 5L, 7L, 11L, 7L, 
6L, 6L, 6L, 6L, 6L, 5L, 4L, 3L, 4L, 7L, 2L, 7L, 8L, 12L, 10L, 
8L, 5L, 5L, 10L, 12L, 9L, 8L, 5L, 10L, 6L, 9L, 10L, 4L, 6L, 12L, 
6L, 7L, 5L, 5L, 3L, 8L, 22L, 5L, 10L, 5L, 4L, 9L, NA, 19L, 15L, 
4L, NA, 18L, 17L, 14L, 17L, 8L, 7L, 8L, 13L, 8L, 13L, 13L, 21L, 
17L, 15L, 20L, 20L, 20L, 20L, NA, 14L, 15L, 14L, 7L, 8L, 14L, 
15L, 11L, 9L, 14L, 18L, 14L, 10L, 11L, 12L, 18L, 15L, 17L, 12L, 
17L, 13L, 15L, 16L, 9L, 14L, 14L, 13L, 13L, 16L, 14L, 11L, 12L, 
13L, 13L, 6L, 11L, 16L, 18L, 10L, 13L, 16L, 14L, 18L, 16L, 14L, 
20L, 16L, 16L, 15L, 14L, 21L, 15L, 16L, 11L, 12L, 12L, 5L, 11L, 
11L, 14L, 11L, NA, 10L, 7L, 15L, 4L, 16L, 9L, 11L, 9L, 10L, 7L, 
6L, 12L, 13L, 12L, 13L, 15L, 18L, 16L, 13L, 14L, 14L, 12L, 15L, 
13L, 2L, 8L, 4L, 5L, 2L, NA, 4L, 3L, 3L, 6L, 11L, 6L, 3L, 6L, 
4L, 4L, 8L, 5L, 3L, 11L, 1L, 1L, 3L, 2L, 11L, 11L, 4L, 4L, 4L, 
8L, 10L, 11L, 7L, 15L, 16L, 10L, 13L, NA, 9L, 10L, 10L, 15L, 
7L, 10L, 10L, 6L, 15L, 9L, 17L, 9L, 7L, 7L, 5L, 10L, 7L, 3L, 
4L, 12L, NA, 8L, 6L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 3L, 9L, 1L, 1L, 1L, 
1L, 1L, 1L, 3L, 1L, 20L, 22L, 18L, 12L, 12L, 17L, 15L, NA, NA, 
NA, 11L, NA, NA, 18L, 16L, 13L, 11L, 10L, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, 16L, NA, NA, NA, 6L, 8L, 6L, 10L, 8L, 7L, 8L, 
7L, 5L, 6L, 9L, 5L, 9L, 6L, 3L, NA, NA, 4L, 9L, 5L, 3L, 4L, 8L, 
5L, 5L, 4L, 7L, 7L, 7L, 6L, 4L, 24L, 23L, 17L, 21L, 25L, 26L, 
25L, NA, 22L, 18L, 25L, NA, NA, 26L, 25L, 20L, 23L, 26L, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, 25L, NA, NA, NA, 23L, 26L, 25L, 
26L, 28L, 28L, 26L, 19L, 26L, 25L, 27L, 24L, 24L, 28L, 27L, NA, 
25L, 25L, 22L, 23L, 23L, 24L, 23L, 23L, 23L, 24L, 20L, 23L, 21L, 
24L, 25L, 18L, 20L, 21L, 14L, 23L, 18L, 18L, 14L, 18L, 14L, 20L, 
17L, 18L, 20L, 21L, 14L, 17L, 18L, 16L, 15L, 17L, 15L, 16L, 14L, 
14L, 19L, 17L, 15L, 16L, 19L, 20L, 3L, 3L, 4L, 1L, 3L, 3L, 3L, 
2L, 4L, 4L, 3L, 12L, 3L, 2L, 5L, 2L, 2L, 5L, 3L, 4L, 12L, 8L, 
3L, 4L, 3L, 2L, 2L, 3L, 3L, 2L, 3L, 16L, 16L, NA, 9L, 17L, 15L, 
16L, 12L, 16L, 20L, 18L, 20L, NA, 17L, 12L, 16L, 18L, 21L, 20L, 
17L, 19L, 19L, 18L, 19L, 17L, 14L, 16L, 20L, 17L, 18L, 17L, 14L, 
9L, 3L, 16L, 14L, 11L, 9L, 9L, 13L, 9L, 8L, 8L, 15L, 15L, 13L, 
5L, 7L, 6L, 13L, 7L, 6L, 9L, 7L, 7L, 12L, 10L, NA, 9L, 11L, 14L, 
12L, 2L, 4L, NA, 3L, 1L, 4L, 2L, NA, 2L, 2L, 2L, 2L, 2L, 5L, 
4L, 3L, 3L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 4L, 5L, 3L, 2L, 2L, 1L, 
2L, 11L, 13L, 9L, 8L, 9L, 13L, 12L, 13L, 19L, 12L, 17L, 13L, 
12L, 11L, 8L, NA, 5L, 11L, 8L, 11L, 14L, 13L, 11L, 6L, 6L, 9L, 
6L, 5L, 5L, 5L, 7L, 27L, 25L, 23L, 23L, 22L, 23L, 22L, 17L, 24L, 
23L, 22L, 22L, 20L, 22L, 22L, 17L, 21L, 22L, 23L, 21L, 20L, 23L, 
22L, 22L, 20L, 22L, 19L, 22L, 22L, 23L, 23L, 15L, 15L, 13L, 17L, 
15L, 12L, 10L, 10L, 15L, 16L, 16L, 16L, 14L, 12L, 7L, NA, 6L, 
17L, 12L, 10L, 9L, 18L, 17L, 8L, 13L, 12L, 10L, 6L, 12L, 11L, 
14L, 22L, 21L, 20L, NA, 24L, 22L, 21L, 16L, 23L, NA, 26L, 21L, 
22L, 23L, 23L, NA, 20L, 23L, 19L, 20L, 21L, 20L, 21L, 20L, 21L, 
21L, 18L, 24L, 19L, 21L, 21L), sequence = 1:868), row.names = c(NA, 
-868L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000000231ef0>, index = structure(integer(0), "`__Short name`" = integer(0)))

数据的头和尾

> head(onlyrank)
   Short name       Date       variable value sequence
1:         AP 2018-12-14 rankofmeanrank     7        1
2:         AP 2018-12-15 rankofmeanrank    10        2
3:         AP 2018-12-16 rankofmeanrank    10        3
4:         AP 2018-12-17 rankofmeanrank    22        4
5:         AP 2018-12-18 rankofmeanrank    10        5
6:         AP 2018-12-19 rankofmeanrank     9        6
> > tail(onlyrank)
   Short name       Date       variable value sequence
1:         WB 2019-01-08 rankofmeanrank    21      863
2:         WB 2019-01-09 rankofmeanrank    18      864
3:         WB 2019-01-10 rankofmeanrank    24      865
4:         WB 2019-01-11 rankofmeanrank    19      866
5:         WB 2019-01-12 rankofmeanrank    21      867
6:         WB 2019-01-13 rankofmeanrank    21      868

并且gganimate + ggplot代码为

r1 <- ggplot(onlyrank,aes(x=Date,y=value,group=`Short name`))+
      geom_line(aes(size=2,colour=`Short name`,group=`Short name`),
                    alpha=0.9,show.legend = FALSE)+ 
      geom_point(aes(colour=`Short name`),size=3,show.legend = FALSE)+ 
      geom_segment(aes(xend=lastdate,yend=value),linetype=2)+
      geom_text(aes(x=lastdate+1,y=value,
                    label=paste0(`Short name`,"(",value,")")))+
      scale_y_reverse()+
      coord_cartesian(clip="off")+
      transition_reveal(along=sequence)+
      ease_aes()

animate(r1,renderer = gifski_renderer(file="ranking.gif"),
        width = 1280, height = 720,nframes = 200)

到目前为止很好..基于所创建的动画..我有一些探针和愿望

问题

1。我的geom_points似乎没有显示..为什么?(组中有问题吗?即使显式设置组aes也不起作用)

更新28/1 充分理解API之后,我意识到我需要在geom_point中正确添加组,如下所示:

geom_point(aes(group =sequence),colour="black",size=3,show.legend = FALSE)

现在这些点已正确可见

2。Dates上的动画无法渲染覆盖所有日期,渲染(补间?)在几个日期上成块状出现。.似乎没有畅通无阻。不同的nframe一直达到700,每秒fps动画直到25 ..零星的感觉仍然存在..我严重怀疑我正在做的一些基本错误..那我需要纠正什么错误?

更新28/01
我将nframe缩放到3000,最终动画变得平滑了,但是gif的大小增加到了29 MB(由于大小我无法上传)。所以问如何将其缩小为更小的尺寸?< / strong>

所以最终代码现在看起来如下所示

lastdate<-sort(unique(onlyrank$Date),decreasing = TRUE)[1]+1
r1 <- ggplot(onlyrank,aes(x=Date,y=value))+
  geom_line(aes(colour=`Short name`,group=`Short name`),size=2,alpha=0.9,show.legend = FALSE)+
  geom_point(aes(group =sequence),colour="black",size=3,show.legend = FALSE)+
  geom_segment(aes(xend=lastdate,yend=value,group=`Short name`),linetype=2)+
  geom_text(aes(x=lastdate+1,y=value,label=paste0(`Short name`,"(",value,")"),group=`Short name`,colour=`Short name`))+
  scale_y_reverse()+
  coord_cartesian(clip="off")+
  transition_reveal(along=sequence)+
  ease_aes()

animate(r1,renderer = renderer = gifski_renderer(file="ranking.gif"),width = 1280, height = 720,nframes = 3000)

更新02-02 使用出色的 gifsicle 可以将其缩小为较小的版本 enter image description here

愿望

3.i希望将该状态的geom_line的能见度(αalpha)设置为最小,以便在整个日期范围内充分显示。.以确保当前显示的状态不会在混乱中丢失

更新28/01 这个问题还没有解决。.我还没有一点线索,如果transition_reveal可以与enter_ *&exit _ * ...任何帮助一起使用

更新02/02

仍然很杂乱..所以在通过动画后,如何将每行涂成灰色...

想法?

有人在偷看和建议吗?

最佳问候 拉吉卜

0 个答案:

没有答案