gganimate不会显示移动点的踪迹

时间:2019-06-28 04:04:04

标签: r ggplot2 gganimate

我正在尝试创建自己制作的ggplot的动画,但是它没有使用transition_time创建轨迹,我已经阅读并看到人们使用transition_reveal却得到了此错误消息

png :: readPNG(frames 1,native = TRUE)中的错误:   无法打开/var/folders/_z/y8zrlqwj4fs2wgkxyrztvqhr0000gn/T//Rtmp2zZJVG/1a492ff72039/gganim_plot0001.png 另外:有50个或更多警告(请使用warnings()查看前50个警告)

下面是带有功能transition_time的gif

enter image description here

在最后一帧,我试图使其看起来像我在下面制作的原始ggplot

enter image description here

这是我的一部分数据

@{var items = Model.Where(x => x.product == product).ToList();}
@for (int i = 0; i < items.Count; i++)
{
... stuff with items[i] ...
}
exports.scheduledIndexUpdate = functions.pubsub
  .schedule("every 30 minutes")
  .onRun(context => {
    console.log("This will be run every 30 minutes!");

    var newIndex;
    var getIndex = new Promise((resolve, reject) => {
      admin
        .firestore()
        .collection("billsIndex")
        .doc("GS2019Index")
        .get()
        .then(doc => {
          if (doc.exists) {
            newIndex = doc.data();
            resolve(newIndex);
          }
        });
    });
    return getIndex.then(index => {
      var keys = Object.keys(index);

      keys.forEach(function(key) {
        admin
          .firestore()
          .collection("billsMetaData")
          .doc(key)
          .get()
          .then(doc => {
            if (doc.exists) {
              const metaData = doc.data();
              let agree = 0,
                disagree = 0,
                neutral = 0,
                somewhatAgree = 0,
                somewhatDisagree = 0;

              if (metaData.votes) {
                if (metaData.votes.agree) {
                  agree = metaData.votes.agree;
                }
                if (metaData.votes.disagree) {
                  disagree = metaData.votes.disagree;
                }
                if (metaData.votes.neutral) {
                  neutral = metaData.votes.neutral;
                }
                if (metaData.votes.somewhatAgree) {
                  somewhatAgree = metaData.votes.somewhatAgree;
                }
                if (metaData.votes.somewhatDisagree) {
                  somewhatDisagree = metaData.votes.somewhatDisagree;
                }

                newIndex[key].userVotes =
                  agree + disagree + neutral + somewhatAgree + somewhatDisagree;
              }
            }
          });
      });
      Promise.all(keys).then(function(result) {

          admin
            .firestore()
            .collection("billsIndex")
            .doc("GS2019Index2")
            .set({
              newIndex
            });
          console.log(newIndex);
          console.log("done");

      });
    });
   });

1 个答案:

答案 0 :(得分:3)

transition_reveal(Year.Published) + labs(title = "Year: {round(frame_along, 0)}")替换最后两行,我得到下面的动画。像aes()中的ggplot2调用一样,transition_*术语正在查找表和$之外的列名,并且transition_reveal的计算变量不同于transition_time

enter image description here