Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfaults when using the 'plot.network' function #109

Closed
bockthom opened this issue Mar 23, 2018 · 1 comment
Closed

Segfaults when using the 'plot.network' function #109

bockthom opened this issue Mar 23, 2018 · 1 comment

Comments

@bockthom
Copy link
Collaborator

Description

Sometimes, when plotting networks having thousands of edges, the plot.network function ends in a segfault or any other unexpected behaviour causing R to crash.

Thanks to @hechtlC for reporting this bug.

Suggested solutions

After trying out some things, @clhunsen and me found two different solutions, which are described in the following:

Solution 1: Do not directly plot the network by plot.network, but get the plot object and save it to file:

p = plot.get.plot.for.network(network)
ggsave(file="/your/desired/filepath/network.pdf", p) # maybe adapt height and width parameters

Depending on R version and some other circumstances, this might work in most cases.

Solution 2: It turned out that the segfaults may be caused by the layout. Therefore, do use another layout, we suggest the "kk" layout as default.

The only thing to do is the following replacement:
In util-plot.R replace the following statement, which defines the layout,
https://github.com/se-passau/codeface-extraction-r/blob/34b9d35617e0d043d86a457b56d2ebc0a5ef02cd/util-plot.R#L120
by

p = ggraph::ggraph(network, layout = "kk")

Then you should be able to use plot.networks(network) without any problems.

Using the "kk" layout did work in all our tries, so we should use "kk" as default layout.

Versions

The described problems and solutions address versions 3.x of this network library.

There may be additional problems using outdated packages. Therefore, you should at least use the following package versions:

viridis 0.4.1
viridisLite 0.2.0
ggraph 1.0.0
ggplot2 2.2.1

Using those package versions, the suggested solutions Solution 1 and Solution 2 should work.

@hechtlC If you still have some plotting problems using those versions, let us now.


Additional Information

For future improvement, we should make the layout configurable, so that the end user can easily choose another layout. Nevertheless, first, we should use the "kk" layout as default, as some things for enabling configurable layout have to be figured out first...


@clhunsen
Copy link
Collaborator

clhunsen commented Apr 6, 2018

Fixed with the merge of #111.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants