Discussion:
[igraph] tkplot() - error message
Diana Neufeld
2009-09-23 14:02:51 UTC
Permalink
Dear all,

I have a question to the function: tkplot().
print(graph)
Vertices: 51
Edges: 463
Directed: TRUE
tkplot(graph , layout=pub.mat)
I get the error message:

Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = "tclObj") :
[tcl] bad screen distance "-pubMedID".

pub.mat is a matrix with two columns like this:

pubMedID ArticleDate
12 53631 11
15 475066 14
16 517816 15
14 637382 13
13 744792 12
27 1415150 26
…

Without the argument layout in the function tkplot() it works.
Whit plot.igraph(graph, layout=pub.mat) it also works. But I need an interactive graphic.
What does the error message mean? Where is the problem?

regards, di

________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/
Tamas Nepusz
2009-09-23 14:14:24 UTC
Permalink
Dear Diana,
Post by Diana Neufeld
tkplot(graph , layout=pub.mat)
[..]
pubMedID ArticleDate
12 53631 11
15 475066 14
The layout() argument of tkplot needs a graph layout; it is a matrix
with N rows and two columns, the first column containing the X
coordinate of the node on the plot, the second column containing the Y
coordinate. Your matrix does not look like a valid layout. igraph
tries to interpret it as a layout, so the PubMed IDs will be treated as
X coordinates, but they are too large.
What you will have to do is:

Either call tkplot() without the layout= option and set a layout from
the menu of the window opened by tkplot() -- you can also rearrange the
nodes by the mouse if you don't like the layout generated by igraph.
Alternatively, you can pre-calculate a layout using igraph's various
layout methods and pass the matrix obtained from the layout function. An
example:

layout <- layout.fruchterman.reingold(graph)
tkplot(graph, layout=layout)

Best,
--
Tamas
Diana Neufeld
2009-09-23 15:05:40 UTC
Permalink
Dear Tamas, dear all,


thanks for your answer.
My matrix contains PubMedID’s in the first column and the ArticleDate in the second.
So what I want is to get a graphic with a y-axis and vertices depends on time (ArticleDate).
The additional information I have: publications and their references (data frame with two columns).
How can I use this time-information to get a graph, whose vertices are not randomly placed on a
window opened by tkplot().
And if I rename my PubMedID’s in short notations, so it could work?

Thanks, Di.
-----Ursprüngliche Nachricht-----
Gesendet: 23.09.09 16:14:46
Betreff: Re: [igraph] tkplot() - error message
Dear Diana,
Post by Diana Neufeld
tkplot(graph , layout=pub.mat)
[..]
pubMedID ArticleDate
12 53631 11
15 475066 14
The layout() argument of tkplot needs a graph layout; it is a matrix
with N rows and two columns, the first column containing the X
coordinate of the node on the plot, the second column containing the Y
coordinate. Your matrix does not look like a valid layout. igraph
tries to interpret it as a layout, so the PubMed IDs will be treated as
X coordinates, but they are too large.
Either call tkplot() without the layout= option and set a layout from
the menu of the window opened by tkplot() -- you can also rearrange the
nodes by the mouse if you don't like the layout generated by igraph.
Alternatively, you can pre-calculate a layout using igraph's various
layout methods and pass the matrix obtained from the layout function. An
layout <- layout.fruchterman.reingold(graph)
tkplot(graph, layout=layout)
Best,
--
Tamas
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/
Tamas Nepusz
2009-09-23 18:42:40 UTC
Permalink
Dear Diana,

First I'd try to normalize the layout matrix so that both the X and Y
coordinates are within a reasonable range:

layout <- layout.norm(pub.mat, xmin=0, xmax=1, ymin=0, ymax=1)
tkplot(graph, layout=layout)

This probably won't look too good as the PubMed IDs and the years
might be correlated (an article that's published later will have a
higher PubMed ID, so the X and Y coordinates will be positively
correlated). But I guess it's a good starting point.
--
Tamas
Post by Diana Neufeld
Dear Tamas, dear all,
thanks for your answer.
My matrix contains PubMedID’s in the first column and the
ArticleDate in the second.
So what I want is to get a graphic with a y-axis and vertices
depends on time (ArticleDate).
The additional information I have: publications and their references
(data frame with two columns).
How can I use this time-information to get a graph, whose vertices
are not randomly placed on a
window opened by tkplot().
And if I rename my PubMedID’s in short notations, so it could work?
Thanks, Di.
-----Ursprüngliche Nachricht-----
Gesendet: 23.09.09 16:14:46
Betreff: Re: [igraph] tkplot() - error message
Dear Diana,
Post by Diana Neufeld
tkplot(graph , layout=pub.mat)
[..]
pubMedID ArticleDate
12 53631 11
15 475066 14
The layout() argument of tkplot needs a graph layout; it is a matrix
with N rows and two columns, the first column containing the X
coordinate of the node on the plot, the second column containing the Y
coordinate. Your matrix does not look like a valid layout. igraph
tries to interpret it as a layout, so the PubMed IDs will be
treated as
X coordinates, but they are too large.
Either call tkplot() without the layout= option and set a layout from
the menu of the window opened by tkplot() -- you can also rearrange the
nodes by the mouse if you don't like the layout generated by igraph.
Alternatively, you can pre-calculate a layout using igraph's various
layout methods and pass the matrix obtained from the layout
function. An
layout <- layout.fruchterman.reingold(graph)
tkplot(graph, layout=layout)
Best,
--
Tamas
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/
_______________________________________________
igraph-help mailing list
http://lists.nongnu.org/mailman/listinfo/igraph-help
Loading...