briatte / ggnetwork

Geoms to plot networks with ggplot2
https://briatte.github.io/ggnetwork/
146 stars 27 forks source link

Problem converting igraph to ggnetwork #36

Closed andrewd789 closed 5 years ago

andrewd789 commented 5 years ago

Hi, I have an igraph object that I want to visualise using ggnetwork, but I keep getting the same error. I can plot the igraph object like this: plot(ig) But if I try this: ggnetwork(ig) or this: ggplot(ig) I always get this error message:

    Error in .Call(setVertexAttribute_R, x, attrname, value, v) : 
    NULL value passed as symbol address

What does this mean, and how would I fix it?

andrewd789 commented 5 years ago

It now seems this is not a problem with ggnetwork, as I encounter the same issue using network(ig) or intergraph::asNetwork(ig). I still don't know what the solution is though.

andrewd789 commented 5 years ago

Further to this, I updated R from 3.5.1 to 3.5.2, and igraph, network, and intergraph to latest versions, and the problem was resolved. (Still not sure why it happened though).

briatte commented 5 years ago

Dear @andrewd789

Thanks for your report, and apologies for answering it very late.

The latest update to ggnetwork (not yet on CRAN) should fix your issue: thanks to @jcfisher, ggnetwork now supports igraph natively, which was not really an option when I created the package several years ago.

You mention that you are running old-ish versions of R: I'd recommend always running the latest version, as well as running the most recent version of, in your case, igraph. Some of the packages used by ggnetwork are still going through lots of bug fixes, and ggnetwork itself is a v0.x kind of package.

Thanks again for your report!