2

I'm trying to rotate the R package based igraph network plot. In the igraph guidebook not enough explanation how to use R code

tk_rotate(tkp.id, degree = NULL, rad = NULL) 
  • Thanks for your question. To get the best answer possible I would recommend trying to present a reproducible example [see here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). That way others can see what you have tried, copy and paste your code and recommend a solution. Also check out the example code at the bottom of R help documents as these can help demo the functions you are interested in. – Dean Sep 03 '18 at 05:31
  • I have supplied an answer to you question in the meantime, if this does not help, please try and be more specific per above comment. – Dean Sep 03 '18 at 05:31

1 Answers1

1

For the R package igraph according to the documentation:

the tk_rotate rotates the figure, its parameter can be given either in degrees or in radians.

Of particular note is the argument tkp.id. Make sure you assign the tkplot window to this value so you can reference it as the tkp.id in the function.

tkp.id The id of the tkplot window to close/reshape/etc.

Here is a reproducible example that demonstrates it's use:

library(igraph)
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
g <- make_ring(10)
x <- tkplot(g)
tk_rotate(x, degree = NULL, rad = NULL)

Created on 2018-09-03 by the reprex package (v0.2.0).

Dean
  • 479
  • 3
  • 9
  • Thanks @Dean, in what format to give 'degree' and 'rad' values? – Ajay Kumar Koli Sep 03 '18 at 05:41
  • Either degrees or radians as a numeric value. I'd encourage you to try it yourself in R and see what works to ensure you get the result you are after. – Dean Sep 03 '18 at 05:44
  • Hi @AjayKumarKoli if this or any answer has solved your question please consider [accepting it](https://meta.stackexchange.com/q/5234/179419) by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Dean Sep 03 '18 at 06:29