Magick Package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Magick Package

Nick Wray
Hello  I'm trying to use the Magick package for animations - it has
downloaded OK but says that it was built under version 4.0.5 and that
fontconfig and x11 features are disabled.  Atm I am using R 1.4.1103   Am I
being naive in assuming that all later versions of R subsume the features
of earlier ones or is it that some packages stop being useable with later
updates?
In any event I have some code for an animation sequence which I have
downloaded from the site -Lesson 39 – Discrete distributions in R: Part I –
dataanalysisclassroom <https://www.dataanalysisclassroom.com/lesson39/>
 the code runs without an error message but it doesn't give the animation
sequence you see on the website
Any help suggestions appreciated   Nick Wray

######## Animation #########

# Create png files for Binomial distribution png(file="binomial%02d.png",
width=600, height=300)

 n = 181

x = 0:181



p = 0.1

for (i in 1:5)

{

px = dbinom(x,n,p)

 plot(x,px,type="h",xlab="Random Variable X (Number of tickets in 181
days)",ylab="Probability P(X=k)",font=2,font.lab=2)

txt = paste("p=",p,sep="")

text(150,0.04,txt,col="red",cex=2)

p = p+0.2

}

dev.off()



# Combine the png files saved in the folder into a GIF #



library(magick)



binomial_png1 <- image_read("binomial01.png","x150")

binomial_png2 <- image_read("binomial02.png","x150")

binomial_png3 <- image_read("binomial03.png","x150")

binomial_png4 <- image_read("binomial04.png","x150")

binomial_png5 <- image_read("binomial05.png","x150")



frames <- image_morph(c(binomial_png1, binomial_png2, binomial_png3,
binomial_png4, binomial_png5), frames = 15)

animation <- image_animate(frames)



image_write(animation, "binomial.gif")

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Magick Package

Duncan Murdoch-2
CONTENTS DELETED
The author has deleted this message.