2
votes

Is it possible to save a tkplot as pdf? What of adding a legend to it?

Below is the code that I have tried using; where after moving the vertices that overlapped and proceeding to use plot, I do not get a similar image as the one in tkplot which is clearer...

Coord <- tkplot(MGraph, vertex.size=3, vertex.label=NA, 
              edge.arrow.size=0.5, edge.color="black")
MCoords <- tkplot.getcoords(Coord)
plot(MGraph, layout=MCoords, vertex.size=5, 
             vertex.label=NA, edge.arrow.size=0.5, edge.color="black")
1

1 Answers

2
votes

You can save your tkplot to eps format. For example:

g <- graph.ring(10)
idg <- tkplot(g)
tkp <- igraph:::.tkplot.get(idg)
tkpostscript(tkp$canvas, file = 'filename.eps')

Then you can convert it to a pdf, using some eps2pdf converter.