Skip to content

Plotting Errors when Not All Attributes Assigned #293

@billdenney

Description

@billdenney

When an attribute is assigned to a vertex, the plotting fails for reasons that appear to be related to not assigning default values to vertices (see the as_data_frame() output for what looks like the hint, to me).

library(igraph)
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
schema <- make_empty_graph() + vertices("c", "p1", "p2", color = "green", shape = "rectangle", 
  size = 30, size2 = 30)
plot(schema)

as_data_frame(schema, what = "vertices")
#>    name color     shape size size2
#> c     c green rectangle   30    30
#> p1   p1 green rectangle   30    30
#> p2   p2 green rectangle   30    30

schema <- make_empty_graph() + vertices("c", "p1", "p2", color = "green", shape = "rectangle", 
  size = 30, size2 = 30) + vertices("d")
plot(schema)
#> Error in igraph.check.shapes(params("vertex", "shape")): Bad vertex shape(s): NA.
as_data_frame(schema, what = "vertices")
#>    name color     shape size size2
#> c     c green rectangle   30    30
#> p1   p1 green rectangle   30    30
#> p2   p2 green rectangle   30    30
#> d     d  <NA>      <NA>   NA    NA

schema <- make_empty_graph() + vertices("c", "p1", "p2", color = "green", shape = "rectangle", 
  size = 30, size2 = 30) + vertices("d", shape = "circle")
plot(schema)
#> Error in plot.window(...): need finite 'xlim' values
as_data_frame(schema, what = "vertices")
#>    name color     shape size size2
#> c     c green rectangle   30    30
#> p1   p1 green rectangle   30    30
#> p2   p2 green rectangle   30    30
#> d     d  <NA>    circle   NA    NA

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behaviorplotting 💹Issues related to plotting

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions