[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Making interactive graphs via Bokeh
From: |
Shekhar |
Subject: |
[igraph] Making interactive graphs via Bokeh |
Date: |
Sat, 18 Feb 2017 12:39:04 +0000 |
I am an intermediate level Python user and have recently been using igraph to
visualize netweoks and calculate useful properties. I also have experience
with Bokeh a Python module that helps render interactive plots with zoom
in/out, hover, nodes selection features. How do i pass an igraph into Bokeh or
another such module to make more interactive graphs? Thank u very much!
Sent from my iPhone
> On Feb 17, 2017, at 12:05 PM, "address@hidden" <address@hidden> wrote:
>
> Send igraph-help mailing list submissions to
> address@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.nongnu.org/mailman/listinfo/igraph-help
> or, via email, send a message with subject or body 'help' to
> address@hidden
>
> You can reach the person managing the list at
> address@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of igraph-help digest..."
>
>
> Today's Topics:
>
> 1. misplaced edges in fixed layout (Leroi, Armand M)
> 2. Re: misplaced edges in fixed layout (George Vega Yon)
> 3. Subgraph (Perrone, Alexander G.)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 16 Feb 2017 20:22:57 +0000
> From: "Leroi, Armand M" <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [igraph] misplaced edges in fixed layout
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Hello,
>
> I am using a fixed layout. Under some circumstances, the behaviour of the
> edges appears to interact with vertex.size in an unfortunate way
>
> Below is an example. Here, the default vertex size (15?) gives almost
> invisible vertices. But the edges and arrow heads all line up nicely. So, I
> increase the vertex.size = 300. Now they?re visible, however, some of the
> edges no longer run from vertex-to-vertex. They?re misplaced and pointing in
> the wrong direction. This phenomenon seems to affect y-axis-stacked nodes
> most acutely. Can anyone suggest a fix? Below is a MWE. Play around with
> vertex.size and you should see what I mean.
>
> With thanks
>
> Armand
>
>
>
>
>
>
> nodes <- c('a','b','c','d','e','f')
> x <- c(1540, 1540, 1540,1580,1600,1650)
> y <- c(52, 53, 55,56,54,58)
> from <- c('a','a','a','a','e','d')
> to <- c('b','c','d','e','f','f')
> Nodelist <- data.frame(nodes, x ,y)
> Edgelist <- data.frame(from, to)
> a<- graph_from_data_frame(vertices = Nodelist, d= Edgelist, directed = TRUE)
> plot(a, ylim=c(52,58), xlim=c(1530,1650), asp=0, rescale=FALSE, axes=TRUE,
> vertex.size=400)
>
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/b3705e56/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: smallnodes.pdf
> Type: application/pdf
> Size: 111734 bytes
> Desc: smallnodes.pdf
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/b3705e56/attachment.pdf>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: bignodes.pdf
> Type: application/pdf
> Size: 111725 bytes
> Desc: bignodes.pdf
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/b3705e56/attachment-0001.pdf>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 16 Feb 2017 13:37:30 -0800
> From: George Vega Yon <address@hidden>
> To: Help for igraph users <address@hidden>
> Subject: Re: [igraph] misplaced edges in fixed layout
> Message-ID:
> <address@hidden>
> Content-Type: text/plain; charset="utf-8"
>
> Here is a dirty solution using the netdiffuseR package. In particular, I
> use the function edges_coords which computes edges coordinates considering
> device size and vertices size in terms of the x axis... is not as flexible
> as igraph.plotting, but it solves your issue... Will work on a better
> solution for the future!
>
> rm(list =ls())
> library(netdiffuseR)
> library(igraph)
>
> nodes <- c('a','b','c','d','e','f')
> x <- c(1540, 1545, 1540,1580,1600,1650)
> y <- c(52, 53, 55,56,54,58)
> from <- c('a','a','a','a','e','d')
> to <- c('b','c','d','e','f','f')
> Nodelist <- data.frame(nodes, x ,y)
> Edgelist <- data.frame(from, to)
> a <- graph_from_data_frame(vertices = Nodelist, d= Edgelist, directed =
> TRUE)
>
> # Getting edge coordinates
> vcex <- runif(nnodes(as_adj(a)), 1, 4)
> ecoords <- edges_coords(
> as_adj(a),
> rep(10L, nnodes(as_adj(a))),
> x = x, y = y,
> vertex_cex = vcex,
> dev = par("pin"), no_contemporary = FALSE,
> undirected = FALSE
> )
>
> ecoords <- as.data.frame(ecoords)
>
> # Plotting
> symbols(x, y, circles=vcex,
> inches=FALSE, xaxs="i", yaxs="i")
>
> with(ecoords, arrows(x0,y0,x1,y1, length=.1))
>
> Best,
>
> George G. Vega Yon
> +1 (626) 381 8171 <(626)%20381-8171>
> http://cana.usc.edu/vegayon
>
> On Thu, Feb 16, 2017 at 12:22 PM, Leroi, Armand M <address@hidden>
> wrote:
>
>> Hello,
>>
>> I am using a fixed layout. Under some circumstances, the behaviour of
>> the edges appears to interact with vertex.size in an unfortunate way
>>
>> Below is an example. Here, the default vertex size (15?) gives almost
>> invisible vertices. But the edges and arrow heads all line up nicely. So,
>> I increase the vertex.size = 300. Now they?re visible, however, some of
>> the edges no longer run from vertex-to-vertex. They?re misplaced and
>> pointing in the wrong direction. This phenomenon seems to affect
>> y-axis-stacked nodes most acutely. Can anyone suggest a fix? Below is a
>> MWE. Play around with vertex.size and you should see what I mean.
>>
>> With thanks
>>
>> Armand
>>
>>
>>
>>
>>
>>
>> nodes <- c('a','b','c','d','e','f')
>> x <- c(1540, 1540, 1540,1580,1600,1650)
>> y <- c(52, 53, 55,56,54,58)
>> from <- c('a','a','a','a','e','d')
>> to <- c('b','c','d','e','f','f')
>> Nodelist <- data.frame(nodes, x ,y)
>> Edgelist <- data.frame(from, to)
>> a<- graph_from_data_frame(vertices = Nodelist, d= Edgelist, directed =
>> TRUE)
>> plot(a, ylim=c(52,58), xlim=c(1530,1650), asp=0, rescale=FALSE, axes=TRUE,
>> vertex.size=400)
>>
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/3f7c6ffe/attachment.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Rplot01.png
> Type: image/png
> Size: 12040 bytes
> Desc: not available
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/3f7c6ffe/attachment.png>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 16 Feb 2017 22:26:06 +0000
> From: "Perrone, Alexander G." <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [igraph] Subgraph
> Message-ID: <address@hidden>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Is there a way to take the induced_subgraph or delete_vertices by modifying
> the graph in place? That is, do not make a copy of the original or create a
> new one from scratch? I'm trying to take the k-core of a graph but vast
> majority of time is *not* the function coreness(g) but rather creating the
> new graph and I'm not interested in the original.
>
>
> Alex
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> <http://lists.nongnu.org/archive/html/igraph-help/attachments/20170216/4ee99a14/attachment.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
> ------------------------------
>
> End of igraph-help Digest, Vol 126, Issue 1
> *******************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [igraph] Making interactive graphs via Bokeh,
Shekhar <=