Skip to content

Cannot map attributes to nodes or edges for bipartite graph #1

@sbanton1

Description

@sbanton1

Hi,

Thanks for the package. It's excellent.
However, I cannot map the attributes to the plot. I have used the same code you did, but it does not work.
I have a bipartite graph with 10 nodes for the first class and 16 nodes for the second class. The plot is built correctly, however the node sizes are not scaled, and the edges are all shown in the legend (i.e. instead of two labels, there are many).

create network objects

obj<-get_network(edgeList,type=type,layout=layout)
net<-c(get_edges(obj,color=color,width=size,name=name,type=type,hoverinfo="none",showlegend=FALSE),
get_nodes(obj,node.data,color=color,size=size,name=name,type=type,hoverinfo="size",showlegend=FALSE))

add legend

legend<-format_legend(obj,node.data=node.data)
net<-c(net,c(get_edges(legend,color=color,width=size,name=name,type=type,hoverinfo="none",showlegend=TRUE),
get_nodes(legend,node.data=legend$node.data,color=color,size=size,name=name,type=type,hoverinfo="name",showlegend=TRUE)))
net<-shiny_ly(net) # works in or out of shiny

add layout options

layout(net,
xaxis = list(title = "", showgrid = FALSE, showticklabels = FALSE, zeroline = FALSE, hoverformat = '.2f'),
yaxis = list(title = "", showgrid = FALSE, showticklabels = FALSE, zeroline = FALSE, hoverformat = '.2f'))

node.data

image

edgeList

image

Thanks,

SB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions