wilkelab/cowplot

Is geom_image (ggimage) not working anymore with Kaggle?

shashivydyula opened this issue · 1 comments

I am trying to plot with ggplot2 and ggimage with the below code on Kaggle

animated_movies<-fread("path to my dataset", stringsAsFactors = T)
str(animated_movies)

#Data structure
str(animated_movies)
colnames(animated_movies)

animated_movies<-animated_movies %>% 
  select(-"id", -"backdrop_path",-"homepage", -"imdb_id", -"poster_path")

top_voted <- animated_movies[, .(title, vote_count)][order(-vote_count)][1:10]
top_voted$title <- factor(top_voted$title, levels = top_voted$title)
top_voted$image_url<-c("https://lumiere-a.akamaihd.net/v1/images/p_insideout_19751_af12286c.jpeg",
                       "https://upload.wikimedia.org/wikipedia/en/0/05/Up_%282009_film%29.jpg",
                       "https://m.media-amazon.com/images/M/MV5BZmYxZjg3OWEtNzg5Yi00M2YzLWI1YzYtYTQ0NTgwNzhjN2E1XkEyXkFqcGdeQXVyNDUyOTg3Njg@._V1_.jpg,",
                       "https://m.media-amazon.com/images/M/MV5BYjQ5NjM0Y2YtNjZkNC00ZDhkLWJjMWItN2QyNzFkMDE3ZjAxXkEyXkFqcGdeQXVyODIxMzk5NjA@._V1_.jpg",
                       "https://lumiere-a.akamaihd.net/v1/images/p_walle_19753_69f7ff00.jpeg",
                       "https://lumiere-a.akamaihd.net/v1/images/p_monstersinc_19751_55afa07a.jpeg",
                       "https://m.media-amazon.com/images/M/MV5BMDU2ZWJlMjktMTRhMy00ZTA5LWEzNDgtYmNmZTEwZTViZWJkXkEyXkFqcGdeQXVyNDQ2OTk4MzI@._V1_.jpg",
                       "https://resizing.flixster.com/-XZAfHZM39UwaGJIFWKAE8fS0ak=/v3/t/assets/p15766_p_v8_ab.jpg",
                       "https://upload.wikimedia.org/wikipedia/en/2/27/The_Incredibles_%282004_animated_feature_film%29.jpg",
                       "https://images.moviesanywhere.com/5948f139cd669fb5984d2c782e7678be/99cedd1f-ae78-4026-a3e8-b79840b71cbc.jpg")



# Plot top voted
plot_top_voted <- ggplot(data = top_voted, aes(
  x = reorder(title, -vote_count),
  y = vote_count,
  fill = title
)) +
  geom_bar(stat = "identity") +
  labs(fill = "Title",
       title = "Top 10 Voted Movies",
       x = "Title",
       y = "Vote Count")+
  geom_image(aes(image=image_url), size=0.1, position = position_nudge(y=10))+
  theme(axis.text = element_text(size = 12, angle = 54, hjust = 1),
        plot.title = element_text(size = 16, hjust=0.5))



plot_top_voted

But I get error as "Error in geom_image(aes(image = image_url), size = 0.1, position = position_nudge(y = 10)): could not find function "geom_image".

But the same code works fine in R Studio for desktop. So, has the support for ggimage on kaggle is withdrawn? Or is it something that Kaggle needs to fix?

Also, is there any alternative to replicate the above scenario with the same results?

This is offtopic here. Not a cowplot issue.