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

Issue in making 'vertex.nsides' be determined by function #15

Closed
pbischoff3 opened this issue Oct 4, 2023 · 1 comment
Closed

Issue in making 'vertex.nsides' be determined by function #15

pbischoff3 opened this issue Oct 4, 2023 · 1 comment

Comments

@pbischoff3
Copy link
Collaborator

Hey @gvegayon! As discussed, here is the error we bumped into.

library(igraph)
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
library(netplot)
#> Loading required package: grid
#> 
#> Attaching package: 'netplot'
#> The following object is masked from 'package:igraph':
#> 
#>     ego

set.seed(123)
g <- erdos.renyi.game(50, 0.2)

teams <- c("Utah", "Wyoming", "Idaho", "Nevada")
V(g)$team <- sample(teams, vcount(g), replace=TRUE) 

# Map teams to sides
team_sides <- c(Utah=4, Wyoming=6, Idaho=3, Nevada=5)
sides <- team_sides[V(g)$team]

# Map teams to colors
team_colors <- c(Utah="red", Wyoming="darkgreen", Idaho="blue", Nevada="purple")

# Get color for each vertex 
vertex_colors <- team_colors[V(g)$team]

# Plot
# Create empty plot
plot(0,type="n", axes=FALSE) 

nplot(g,
      vertex.color = ~team,  
      vertex.nsides= ~team)
#> Error in eval(netenv$vertex.nsides, envir = data): invalid 'envir' argument of type 'closure'

Created on 2023-10-04 with reprex v2.0.2

@gvegayon
Copy link
Member

Using the latest version on CRAN netplot_0.2-0 works OK. Make sure you have the latest version.

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

No branches or pull requests

2 participants