Kudos, more is better!

One in the category of Silly Statistics: Yes, I have finished a run, ride or another sporty activity. Let’s share on Strava and hope that people like it and give me kudos. More is better (less is not more in this case). Anyway, let’s see if our popularity increases over time. If our star is rising.

As usual I start with a data frame with my Strava activities. See this post for details.

library(ggplot2)
load("./Strava/Sport_df.Rda")
Sport <- Sport[Sport$kudos != 0,]      #exclude private activities

We can go straight to plotting the amount of kudos over time, using ggplot. Popularity is increasing!

ggplot(data=Sport, mapping=aes(x=when, y=kudos)) +
   geom_point(shape = 21, alpha = .25, size = 6, fill = "grey10") +
   labs(y="Kudos", x = "Year") +
   theme_light()

Interesting! We are getting noticed! But some more insights in the different activities would be useful. Some addtion to the code to add different fill colors based on the activity type.

ggplot(data=Sport, mapping=aes(x=when, y=kudos, fill = type)) +
   geom_point(shape = 21, alpha = .4, size = 3.5, colour="grey20") +
   labs(y="Kudos", x = "Year") +
   labs(fill = "Activity type") +
   guides(fill = guide_legend(override.aes = list(size=6))) +
   theme_light()

Looking better already, I get the impression that those pinkish colored activities like yoga are not highly appriacted by my fans.
Some more tweaking to add the realtive distance to it. I also added a second legend for the size.

ggplot(data=Sport, mapping=aes(x=when, y=kudos, fill = type, size = dist)) +
   geom_point(shape = 21, alpha = .6, colour="grey80") +
   labs(y="Kudos", x = "Year") +
   labs(fill = "Activity type", size = "Distance [km]") +
   guides(fill = guide_legend(order = 1, override.aes = list(size=5)),
          size = guide_legend(order = 2, override.aes = list(fill = "black"))) +
   theme_light()

If you want to go totally berserk you can add images to each data point. For this I obviously picked the Strava Kudos icon which was used as marker. You will need the ggimage package for plotting the images and I also used the scales to be able to format the x-axes as date.

library(ggimage)
library(scales)

ggplot(data=Sport, mapping=aes(x=date, y=kudos)) +
   labs(y="Kudos", x = "Date") +
   ylim(c(0,60)) +
   scale_x_date(date_breaks = "3 months", labels=date_format("%b-%Y"),
                limits = as.Date(c('2018-01-01','2018-12-31'))) +
   geom_image(aes(image = "kudo.png" ), size = 0.04) +
   theme_light()

Write a Comment

Your email address will not be published. Required fields are marked *