There is a similar question here in CrossValidated, and I have read the answers. My question is a bit different. I don't want to merely visualize my data, and indeed what I want to visualize is not easy to visualize with either package.

I have two sets of points ($x,y$ coordinates) on my plot. I want to add edges and make it similar to a graph. If I have $n$ points, then based on the nature of my problem, I need to add $(n/2)^2$ edges to the plot.

Then I want to add some interactive features to my plot. For instance, by clicking on one point (vertex), all other vertices which are not connected to this clicked vertex must disappear to have a more lucid and focused plot.

I tried to find a network visualization package suited to my project, but it seems all of them use the data about connection of edges or nodes and provide a network based on some specific layout algorithm. My data is different. I have the coordinates of nodes and I want to establish some edges between some of them. In my data the nodes have their own fixed locations and must not be moved around.

Finally, I narrowed down the packages to ggvis and ggplot2. ggvis is new and fresh in addition to having intentional design to generate interactive plots. But I found out that ggplot2+Shiny can also produce interactive plots. (Is that correct?) Besides, I figured that ggplot2's capabilities are more varied and matured than ggvis: for instance ggplot2 has a zooming feature while ggvis does not have it. More important, as ggvis is growing and changing, I don't want to invest a lot of time on a work that becomes technically obsolete or buggy in a year or so. I thought this is the case if I code based on ggvis.

Now may you please evaluate my choice (ggplot2+shiny) and advise me about possibility to do what I want to do with it?

As I did not know any of the mentioned packages, I have started learning ggplot2 from Wickham's book and I love it! But I am afraid of spending a few weeks and finding out that this amazing package cannot do what I want to do even with the aid of Shiny.

P.S: I want to put the final code on github so probable users can download and run it. Therefore, I do not need to make a web application, there is no need to any website or putting the interactive map online. I just need to have an interactive plot which can be run from inside of Rstudio.

  • $\begingroup$ Welcome to the site! Did you try igraph or D3? $\endgroup$
    – Dawny33
    Commented Jan 21, 2016 at 14:49
  • $\begingroup$ Thanks! I reviewed what igraph can do for me and I didn't find it inline with the data that I have. As far as I understood, igraph visualizes a network based on the data of connected vertices (or similar data about edges). Based on some algorithms and priorities, igraph locates the vertices on the plot compatible to the given data. But I want the vertices to be exactly in their corresponding coordinates that I have in my dataset. I don't want the package choose their layout and location. $\endgroup$
    – Shahin
    Commented Jan 21, 2016 at 14:54
  • 1
    $\begingroup$ Why not d3js.org? It sounds like you have very particular requirements. D3 makes it extremely easy to work with SVG. $\endgroup$ Commented Jun 30, 2016 at 17:31
  • $\begingroup$ Have you tried gephi? $\endgroup$
    – M.M
    Commented Jul 25, 2016 at 21:03
  • $\begingroup$ Could you provide a link to the CrossVal question. $\endgroup$
    – Jim
    Commented Sep 25, 2016 at 9:47

2 Answers 2


Well, many months have been passed from this help request. I write this answer to my own request in order to share my experience. I learned ggplot2 and then ggvis as well as Shiny. Shiny can work with both of them, but I found ggvis more structured and lucid comparing to ggplot2. Something which is expectable as the former is being developed based on the development experience of the latter. Moreover, ggvis seems much faster than ggplot2 in quick graph/chart generation, it seems much more suitable for 'Shiny' and creating an applet. However, the negative point is the lack of many features in ggvis since the package is under development and has not become matured yet.

And many thanks to comments here. I have checked Gephi, it wouldn't help. I created my applet which works really fine, however I finally reached to this point that I need to use more powerful tools such as d3js, as one has already suggested.


Time flies! After 2years of working experience, now I answer to my own question with better understanding of Shiny,R, and interactive visualization.

The Plotly is by far the best answer. It can be easily used by ggplotly() conversion of ggplot2 static plots, or directly by learning the logic behind the Plotly functions.

The latter case is suggested for applications with diverse plots.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.