Problem using library wordcloud2

Hello everyone. I am currently trying to use wordcloud2 to generate a wordcloud for my university as

library(wordcloud2)

Name <- c("Universidad", "Master", "Carrera", "Doctorado", "UMH", "Ciencia de datos","Ordenador", "Graficos", "Python", "Rstudio", "Elche", "Informatica", "Algebra", "CIO", "Nightingale", "Conferencia", "Mapa", "Profesores", "Alumnos",  "Pizarra", "Boligrafo", "Lapiz", "Calculadora", "Pie")
Freq <- c(53, 50,46, 42, 37, 34, 32, 31, 29, 28, 26, 22, 21, 18, 14, 12, 11, 9, 7, 4, 4, 3, 3, 3)

df <- data.frame(Name, Freq)

wordcloud2(data = df)

letterCloud(data=df, word = "UMH", wordSize = 1)

figPath = system.file("logo.png",package = "wordcloud2")
wordcloud2(demoFreq, figPath = figPath, size = 1.5,color = "skyblue")

The source of my code is this webpage.

The first graph appears well enough. However, in the second, the output is a blank image and in the third, it gives me the folowing error:

Error in wordcloud2(demoFreq, figPath = figPath, size = 1.5, color = "skyblue") : 
  cannot find fig in the figPath

Even tough the logo is in the same folder as the code (I have set the folder as working directory). I will attach the logo
logo

I don't know what to do about this. Can someone please help me?

Hi, possibly just this

figPath <- "logo.png"

instead of
figPath = system.file("logo.png",package = "wordcloud2")

as system.file() refers to a file stored in the package. However, you might need to adjust the image as the demo shows a black bird on a transparent png file. It might need to be like that first.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.