101010.pl is one of the many independent Mastodon servers you can use to participate in the fediverse.
101010.pl czyli najstarszy polski serwer Mastodon. Posiadamy wpisy do 2048 znaków.

Server stats:

513
active users

#r

2 posts2 participants0 posts today

Animated TreeMaps in R - the hard way

shkspr.mobi/blog/2021/06/anima

As I am a bear of very little brain, these are notes to myself on my slightly shonky process for creating animated TreeMaps in R. The aim is to end up with something like this:

https://shkspr.mobi/blog/wp-content/uploads/2021/06/animated-tree-map.mp4

Generate the images

Getting the data is left as an exercise for the reader (sorry!). This loops through the data and generates a separate image for each TreeMap:

for(week in weeks) {  weekly_data <- subset(file_data, Week == week)  size <- sqrt(sum(weekly_data$Count)) / 2  if (size < 40) {    size <- 40  }  map <- ggplot(weekly_data, aes(area = Count, label = paste(Filetype,formatC(Count, big.mark=",") ,sep="\n"), subgroup = Category, fill=Category)) +    geom_treemap(layout="fixed") +    geom_treemap_text(colour = "white", place = "centre", grow = TRUE, layout="fixed")  file_name <- paste("media/", weekly_data$Week[1], ".png", sep="")  ggsave(file_name, map, width = size, height = size, units = "mm")}

The width and height are proportionate the the square-root of the size of the data. Annoyingly, ggplot works in millimetres rather than pixels!

If images are too small, R throws an error of "Viewport has zero dimension(s)". So this sets a minimum size. This value was found using trial and error.

The layout is fixed, as per the documentation which keeps the order of the elements and their labels.

Resize and reorientate the images

Now I have a directory of images, each a different size. I want all of them to have the same size canvas and to be placed against the right-hand edge.

mogrify -gravity east -background white -extent 1750x1750 *.png 

That sets the "gravity" to the right - so the original image is centred vertically but is up against the right edge. The extent is the dimension of the new image.

Mogrify overwrites the original images.

Make a video

This is a lazy way to shove all the images into a video.

cat *.png | ffmpeg -f image2pipe -r 10 -vcodec png -i - -vcodec libx264 out.mp4

or

ffmpeg -framerate 8 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4

Some websites will need further conversion as they have specific codec requirements.

That's it

It isn't the prettiest way to do things, but it seemed pretty effective. If you know of a more efficient - or more R-ish way to accomplish the same animation - please let me know.

Terence Eden’s Blog · Animated TreeMaps in R - the hard way
More from Terence Eden
#data#HowTo#MSc
初音ミク│Miku Hatsune / STUDIO『bibit』 / June 14, 2025 3:00 PM
✅️初音ミク R18 192枚セットの商品をBOOTHにて公開中です。
BOOTH: https://bibit.booth.pm/items/6863528
~もっとエッチな「特典付きEDITION」販売開始しました!~

✅️STUDIO「bibit」Discordサーバーのご案内
https://discord.gg/UGbGRVVH54
👆️たくさんのイラストを見ることができます.您可以看到许多插图👆
#AIgenerated #R-18 #初音ミク #VOCALOID #ボーカロイド #ハメ撮り視点 #ミク
https://www.pixiv.net/en/artworks/131543716
https://www.pixiv.net/en/users/76316220

Draft programme for the OpenGeoHub summer school "Data Science for Earth Observation: Hands-on Training in Python, R and Julia" 1—6 September 2025, WICC, Wageningen, is now ready: opengeohub.org/summer-school/s
We are excited to have over 20 lecturers, guru's of open source! giving hands-on sessions + hackathons + many social events. Over 40 hrs of coding & hacking. Don't miss a chance and register while there are still places (deadline: 1st of July)! #python #R #earthobservation #Geospatial #coding

#R you ready to level-up your data skills 🙌📈

Participants like Moira Wiedebusch undertook courses in R, Tidyverse and data visualization through the GBIF and DataCamp partnership last year.

"After finishing my class I continued using DataCamp to learn more about the uses of R, how to start doing statistical analysis and visualizations using my own data. This has helped me to continue my research and better understand statistical concepts." 👩‍💻

🔗gbif.link/datacampdonates

Awesome Strategies To Visualize Change With Time
--
medium.com/@yuanbo.faith/aweso <-- shared technical article
--
databrewer.co/R/gallery <-- shared further examples & background/processes
--
“This article summarizes effective strategies to visualize temporal changes, illustrated with inspiring graphic examples (with link to source code [and methods])…”
#GIS #spatial #mapping #datavisualisation #visualisation #R #code #methods #scripts #opensource #spatiotemporal #temporal #temporalchange #visualise #graphic #examples #opendata

There are 1153 alias shared between CRAN and base #R The most repeated are: plot, summary, predict, print, show, filter, plot-methods, coef, .onAttach, data.

Are #rstats package maintainers aware that when the user click on a link they might be redirected to a disambiguation page instead of the page they have in mind?

Did you know there are 16156 packages that share 36976 duplicated targets with other packages on CRAN?