程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了R 卡在 anim_save 中渲染大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决R 卡在 anim_save 中渲染?

开发过程中遇到R 卡在 anim_save 中渲染的问题如何解决?下面主要结合日常开发的经验,给出你关于R 卡在 anim_save 中渲染的解决方法建议,希望对你解决R 卡在 anim_save 中渲染有所启发或帮助;

我尝试在下面运行此代码。我遇到的问题是,如果我不设置宽度和高度,它会保存,如果我设置宽度和高度,它会一直运行而不保存(我尝试让它运行一天)。 我也在多台机器上尝试了代码。 非常感谢您的帮助

## Data generation (This works,but is included to reproduce the exact data)
set.seed(2711)
library('MASS')
library(tIDyversE)
library(magrittr)
library(gganimatE)

group_loop_df <- 
lapply(seq(100,1000,100),function(sample_sizE){
  test1 <- data.frame(V1 = truncnorm::rtruncnorm(sample_size,1,10,5,2))
  sumMary_test <- Rmisc::sumMarySE(test1,"V1")

  test1$ci_V1 <- sumMary_test$ci
  test1$sd_V1 <- sumMary_test$sd
  test1$mean_V1 <- sumMary_test$V1
  hist_data <- ggploT_Build(ggplot(test1) +
                            aes(x = V1) +
                            geom_histogram() +
                            theme_classic())$data[[1]]
  test1$ceiling_var <- max(hist_data$count)
  test1$sample_size <- sample_size
  test1$group <- "Group 1"
  
  test2 <- data.frame(V1 = truncnorm::rtruncnorm(sample_size,4,2))
  sumMary_test <- Rmisc::sumMarySE(test2,"V1")

  test2$ci_V1 <- sumMary_test$ci
  test2$sd_V1 <- sumMary_test$sd
  test2$mean_V1 <- sumMary_test$V1
  hist_data <- ggploT_Build(ggplot(test2) +
                            aes(x = V1) +
                            geom_histogram() +
                            theme_classic())$data[[1]]
  test2$ceiling_var <- max(hist_data$count)
  test2$sample_size <- sample_size  
  test2$group <- "Group 2"
  
  overall <- rbind(test1,test2)
  overall$p <- t.test(V1 ~ group,overall)$p.value
  overall
  }) %>%
do.call(rbind,.)




full_hist_overlap <- ggplot(group_loop_df) +
                     geom_histogram(aes((y=..count../sum(..count..)) * 100,x = V1,fill = group) ) + 
                     geom_vline(aes(xintercept = mean_V1,color = group),size = 2) +
                     geom_vline(aes(xintercept = mean_V1 - ci_V1,linetype = "dashed",size = 2) +
                     geom_vline(aes(xintercept = mean_V1 + ci_V1,size = 2) +
                     theme_classic() +
                     labs(y = "Percent of Values",x = NulL) +
                     Transition_states(sample_size,Transition_length = 5,state_length = 10) +
                            ggtitle('Now showing {Closest_statE} samples') +
                            ease_aes('cubic-in-out')  


### This is where the error occurs.
### This works
anim_save("hist_overlap.gif")

### This does not

anim_save("hist_overlap.gif",units = "cm",wIDth = 25.4,height = 14.288,res = 300)

解决方法

这对我有用。我认为解析参数属于 animate 调用的 anim_save 函数,但 anim_save 似乎没有传递这些参数。

R 卡在 anim_save 中渲染

animate(full_hist_overlap,units = "cm",width = 25.4,height = 14.288,res = 300)
anim_save("hist_overlap.gif")

大佬总结

以上是大佬教程为你收集整理的R 卡在 anim_save 中渲染全部内容,希望文章能够帮你解决R 卡在 anim_save 中渲染所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。