# Plotting with Sugiyama: a minor nuissance

**URL:** https://igraph.discourse.group/t/plotting-with-sugiyama-a-minor-nuissance/399
**Category:** Usage
**Tags:** R
**Created:** [2 August 2020 10:22 UTC](https://igraph.discourse.group/t/plotting-with-sugiyama-a-minor-nuissance/399 "2020-08-02T10:22:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![clpippel](https://avatars.discourse-cdn.com/v4/letter/c/65b543/32.png) [@clpippel](https://igraph.discourse.group/u/clpippel)
#### Post date: [2 August 2020 10:22 UTC](https://igraph.discourse.group/t/plotting-with-sugiyama-a-minor-nuissance/399/1 "2020-08-02T10:22:19Z")

</div>

The following works fine:

```auto
     g <- make_tree(7,2)
     plot(g, layout=layout.sugiyama(g)$layout)

```

However, when g happens to be a singleton then an error occurs:  
`Error in norm_coords(layout, -1, 1, -1, 1) : 'layout' not a matrix`

A workaround is not difficult:

```auto
    lll <- layout.sugiyama(g)$layout
    if (vcount(g) == 1) dim(lll) <- c(1,2)
    plot(g, layout=lll)

```

or

`plot(g, layout=matrix(layout.sugiyama(g)$layout, ncol=2) )`

I assume this is a (minor) igraph R package issue (?)

---

<div class="post-metadata">

### Author: ![vtraag](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/vtraag/32/38_2.png) [@vtraag](https://igraph.discourse.group/u/vtraag)
#### Post date: [20 August 2020 08:27 UTC](https://igraph.discourse.group/t/plotting-with-sugiyama-a-minor-nuissance/399/2 "2020-08-20T08:27:32Z")

</div>

To be clear, this problem was also posted in [this](https://github.com/igraph/rigraph/issues/408) issue on GitHub. Indeed, it seems that it should be corrected in the R interface.
