Hi to all, does anybody knows whether there is a package to plot those http://www.equine-science.de/temp/graph.jpg graphs. the thickness of the points and/or the lines should be represent the numbers of behaviours With kind regards Knut
Search for a graph package - see link
17 messages · Knut Krueger, Gábor Csárdi
Yes, the 'igraph' package can do this (http://igraph.sf.net), and I think 'network' can do it, too. Maybe others as well. Best, Gabor
On Mon, Apr 6, 2009 at 4:26 PM, Knut Krueger <rh at krueger-family.de> wrote:
Hi to all, does anybody knows whether there is a package to plot those http://www.equine-science.de/temp/graph.jpg graphs. the thickness of the points and/or the lines should be represent the numbers of behaviours With kind regards Knut
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
G?bor Cs?rdi schrieb: Hi G?bor, thank you for your hint to your package. It is very useful for us. I tried to use the example: http://igraph.sourceforge.net/screenshots2.html#2 Two questions: 1. Is it possible to start from 1 to n instead from 0 to n-1 using graph(data, directed=TRUE) 2. is it possible to change the thickness of the lines depending of the interactions between the nodes automatically? With kind regards Knut
Hi Knut,
On Tue, Apr 7, 2009 at 12:36 PM, Knut Krueger <rh at krueger-family.de> wrote:
G?bor Cs?rdi schrieb: Hi G?bor, thank you for your hint to your package. It is very useful for us. I tried to use the example: http://igraph.sourceforge.net/screenshots2.html#2 Two questions: 1. Is it possible to start from 1 to n instead from 0 to n-1 using graph(data, directed=TRUE)
What about subtracting one? graph(data-1, directed=TRUE)
2. is it possible to change the thickness of the lines depending of the interactions between the nodes automatically?
It depends what you mean by 'automatically'. You can assign an edge
attribute called 'width' and 'plot' (and tkplot and rglplot)
considers it when drawing the graph. See
help("attributes", package="igraph") and ?igraph.plotting for details.
Best,
Gabor
With kind regards Knut
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
G?bor Cs?rdi schrieb:
Hi Knut, What about subtracting one? graph(data-1, directed=TRUE)
yes that is what i mean and did with 0 to n-1 but the item numbers in all other figures are from 1 to n
2. is it possible to change the thickness of the lines depending of the
interactions between the nodes automatically?
It depends what you mean by 'automatically'.
means: Do I have to calculate by myself that there are 4 1> 0 2 2 >1 1 2>0 1 1>3 or is there any "switch" to set the different V(g)$size and E(g)$width to get the following result: iigraph_data <-c(1,0, 1,0, 1,0, 1,0, 2,1, 2,0, 2,1, 1,3) g <- graph( igraph_data,n=max(igraph_data), directed=TRUE ) V(g)$size <- c(40,20,10,10) E(g)$width <- c(4,4,4,4,2,1,1,1) E(g)$arrow.size <- 1 plot.igraph(g, layout=layout.kamada.kawai, vertex.label.font=2) With kind regards Knut
On Tue, Apr 7, 2009 at 1:57 PM, Knut Krueger <rh at krueger-family.de> wrote:
G?bor Cs?rdi schrieb:
Hi Knut, ?What about subtracting one? graph(data-1, directed=TRUE)
yes that is what i mean and did with 0 to n-1 but the ?item numbers in all other figures are from 1 to n
Hmmm, what figures in particular? On the screenshots? I can't seem to see any of them going from 1 to n. But anyway, you can set the 'vertex.label' argument of 'plot' to whatever you want. Please read ?igraph.plotting about how to set plotting parameters.
2. is it possible to change the thickness of the lines depending of the interactions between the nodes automatically?
It depends what you mean by 'automatically'.
means: Do I have to calculate by myself that there are 4 1> 0 2 2 >1 1 2>0 1 1>3 or is there any "switch" to set ?the different V(g)$size and E(g)$width to get the following result: iigraph_data <-c(1,0, 1,0, 1,0, 1,0, 2,1, 2,0, 2,1, 1,3) g <- graph( igraph_data,n=max(igraph_data), directed=TRUE ) V(g)$size <- c(40,20,10,10) E(g)$width <- c(4,4,4,4,2,1,1,1) E(g)$arrow.size <- 1 plot.igraph(g, layout=layout.kamada.kawai, vertex.label.font=2)
Hmmm, how should 'plot' know automatically what size/width you want? Sorry, I don't really know what you want to achieve here. If you want to calculate the width from some properties of the graph, then simply do that and assign it as the 'width' argument. G.
With kind regards Knut
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
7 days later
G?bor Cs?rdi schrieb:
Hmmm, how should 'plot' know automatically what size/width you want? Sorry, I don't really know what you want to achieve here. If you want to calculate the width from some properties of the graph, then simply do that and assign it as the 'width' argument.
Hi G?bor, the radius of the circle is representing the numbers of "actions" of the node to all other nodes. I need an additionally information about the numbers of actions *between* the nodes differentiated by the direction from and to the nodes. Example Node 1 -> 2 1 actions Node 2 -> 1 25 actions Node 3 -> 1 4 actions Node 1 -> 3 10 actions Node 2 -> 3 5 actions Node 3 -> 2 2 actions I am looking for any graph which shows the direction and counts of the actions with f.e different thickness of the arrows, It must be viewable <http://dict.leo.org/ende?lp=ende&p=thMx..&search=viewable> that the actions from Node 2 to Node 1 are much more than from Node 1 to 2 and also more then from node 3 to three, and so on. Maximum nodes: about 20 Regards Knut
On Tue, Apr 14, 2009 at 6:07 PM, Knut Krueger <rh at krueger-family.de> wrote:
G?bor Cs?rdi schrieb:
Hmmm, how should 'plot' know automatically what size/width you want? Sorry, I don't really know what you want to achieve here. If you want to calculate the width from some properties of the graph, then simply do that and assign it as the 'width' argument.
Hi G?bor, the radius of the circle is representing the numbers of "actions" of the node to all other nodes. I need an additionally information about the numbers of actions *between* the nodes differentiated by the direction from and to the nodes. Example Node 1 -> 2 ? ? ?1 actions Node 2 -> 1 ? ?25 actions Node 3 -> 1 ? ? 4 actions Node 1 -> 3 ? 10 actions Node 2 -> 3 ? ? 5 actions Node 3 -> 2 ? ? 2 actions I am looking for any graph which shows the direction and counts of the actions with f.e different thickness of the arrows, It must be ?viewable <http://dict.leo.org/ende?lp=ende&p=thMx..&search=viewable> that the actions from Node 2 to Node 1 are much more than from Node 1 to 2 and also more then from node 3 to three, and so on. Maximum nodes: about 20
Follow along these lines: http://lists.gnu.org/archive/html/igraph-help/2009-04/msg00104.html plus set the 'width' edge attribute to represent the number of actions. Best, Gabor
Regards Knut
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
Follow along these lines: http://lists.gnu.org/archive/html/igraph-help/2009-04/msg00104.html plus set the 'width' edge attribute to represent the number of actions.
Thanks,Gabor this was my first solution, but unfortunately the data are very complicated to visualize. let me expand the example: Example Node 1 -> 2 1 actions Node 2 -> 1 25 actions Node 3 -> 1 4 actions Node 1 -> 3 25 actions Node 2 -> 3 5 actions Node 3 -> 2 25 actions In that case all lines would be thick and the actions Node 1 -> 2 ,Node 3 -> 1,Node 2 -> 3 would be invisible, so I tried the narrow arrows to get above the thick arrows in an other colour, but I found no rule to order them that the are always on the top ... and the team was not satisfied with this suggestion ;-) The would prefer two parallel arrows one for each direction. Its a very long mathematical formula to display those arrows, depending on the radius of the circles, and there is a ...hidden...error in the formula. So I tried to ask again if there is another solution. By the way: Do you know such arrow funtion: arrow(starting_point, angle, length) ? Thanks's for your patient Knut
On Tue, Apr 14, 2009 at 6:46 PM, Knut Krueger <rh at krueger-family.de> wrote:
[...]
In that case all lines would be thick and the actions Node 1 -> 2 ?,Node 3 -> 1,Node 2 -> 3 ? would be invisible, so I tried the narrow arrows to get above the thick arrows in an other colour, but I found no rule to order them that the are always on the top ... and the team was not satisfied with this suggestion ;-)
Then make the arrows narrower. Or assign the arrow width logarithmically to you edge weight. I.e. something like E(g)$width <- log(E(g)$weight)+1
The would prefer two parallel arrows one for each direction.
You can set 'curved' to a value close to zero and then the arrows will be only a bit curved.
Its a very ?long mathematical formula to display those arrows, depending on the radius of the circles, and there is a ...hidden...error in the formula.
I am a bit lost. What formula are we talking about?
So I tried to ask again if there is another solution. By the way: Do you know such arrow funtion: arrow(starting_point, angle, length) ?
I know igraph:::igraph.Arrows, there might be others as well, G. [...]
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
G?bor Cs?rdi schrieb:
The would prefer two parallel arrows one for each direction.
You can set 'curved' to a value close to zero and then the arrows will be only a bit curved.
No I am lost ... do you mean? ... E(g)$curved <- 0.5 ... plot.igraph(g, layout=layout.kamada.kawai, vertex.label.font=2) I do not see any change .. and I do not found any curved assignment in the plot.igraph function.
Its a very
long mathematical formula to display those arrows, depending on the radius
of the circles, and there is a ...hidden...error in the formula.
I am a bit lost. What formula are we talking about?
http://www.equine-science.de/temp/r-graph.jpg I tried to get the starting point of the arrows depending on the distance arrow-centerline node1/node2 and between the tangent right-angled to the centerline of both nodes automatically for all nodes. (I hope you can understand my translated mathematics description...) That's exactly what the team would like to get. Regards Knut
On Wed, Apr 15, 2009 at 9:35 AM, Knut Krueger <rh at krueger-family.de> wrote:
G?bor Cs?rdi schrieb:
The would prefer two parallel arrows one for each direction.
You can set 'curved' to a value close to zero and then the arrows will be only a bit curved.
No I am lost ... do you mean? ... E(g)$curved <- 0.5 ... plot.igraph(g, layout=layout.kamada.kawai, vertex.label.font=2) I do not see any change ..
Because 0.5 the default value. Try 0.1. I.e. library(igraph) g <- graph.ring(3, dir=TRUE, mut=TRUE) g$layout <- layout.circle E(g)$curved <- 0.5 plot(g) E(g)$curved <- 0.1 plot(g)
and I do not found any curved assignment in the plot.igraph function.
It is a good idea to read the documentation as well, especially if you don't understand the code. See ?igraph.plotting and search for 'curved'. [...]
[...] That possible with igraph, you need to define a new vertex shape for it. See ?igraph.vertex.shapes and the R/plot.shapes.R file for some simple example shapes. Or you can write the whole thing for yourself, using 'segments', etc. G.
Regards Knut
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
G?bor Cs?rdi schrieb:
Dear Gabor, I am very sorry but i am not able to reproduce your example. there is no change, i am using r 2.8.0
library(igraph) g <- graph.ring(3, dir=TRUE, mut=TRUE) g$layout <- layout.circle E(g)$curved <- 0.5 plot(g) E(g)$curved <- 0.1 plot(g) It is a good idea to read the documentation as well, especially if you don't understand the code.
hmm maybe I do not understand, but there is no parameter curves inside
the parameter asignment
params <- i.parse.plot.params(graph, list(...))
vertex.size <- 1/200 * params("vertex", "size")
.. frame <- params("plot", "frame")
plot() is only called if !add I think this means only the first time
igraph.Arrows is used to draw the arrows and there I do not find any
assignment for curved.
It is a good idea to read the documentation as well,
See ?igraph.plotting and search for
'curved'.
?igraph.plotting redirects me to plot.common.html and there is no word inside beginning with curv... I also did a complete text search, (before I asked you again) in all files of the R-directory I found it only in the library diagram and network network.arrow(1,1,2,2,curve=0.1,width=0.01,col="red",border="black") # this is working fine or for curved arrowheads. Regards Knut
Knut, I think you have an older version of igraph that does not support curved edges. Again, please read http://lists.gnu.org/archive/html/igraph-help/2009-04/msg00104.html and install version 0.5.2, it is on CRAN now (except for OSX). Gabor
On Wed, Apr 15, 2009 at 11:30 AM, Knut Krueger <rh at krueger-family.de> wrote:
G?bor Cs?rdi schrieb:
Dear Gabor, I am very sorry but i am not able to reproduce your example. there is no change, i am using r 2.8.0
[...]
Gabor Csardi <Gabor.Csardi at unil.ch> UNIL DGM
G?bor Cs?rdi schrieb: Hi Gabor, it seems that anybody doesnt not want us to find a solution ;-)
and install version 0.5.2, it is on CRAN now (except for OSX).
I got the 0.5.1 at 06.April.2009 I just tried the Munich Mirror got 0.5.1 there is also only 0.5.1 on http://mirrors.softliste.de/cran/bin/windows/contrib/ also in r-devel and http://cneurocvs.rmki.kfki.hu/igraph/download/igraph_0.5.2.zip seems to be down. Maybe you could send me the file with email? Regards Knut
Knut Krueger schrieb:
Server is now available again I got the file. Thanks Knut
Dear G?bor, thank you for your help, I tried the 0.5.2 Version. It works fine. The team is very satisfied with the curved graph. Regards Knut