Function Repository Resource:

GraphMouseMagnify

Source Notebook

Dynamically magnify graphs with your mouse

Contributed by: Michael Sollami

ResourceFunction["GraphMouseMagnify"][graph]

gives a view of graph that is dynamically magnified on mouseover.

ResourceFunction["GraphMouseMagnify"][graph,amount,radius]

uses magnification factor amount applied over radius.

Details and Options

ResourceFunction["GraphMouseMagnify"] accepts 2D graphs in the form of a Graph or GraphPlot.

Examples

Basic Examples (4) 

Magnify a graph around your mouse pointer:

In[1]:=
ResourceFunction["GraphMouseMagnify"]@
 GraphPlot[RandomChoice[{0.01, 0.99} -> {1, 0}, {100, 100}]]
Out[1]=

Zoom in on dense graphs and forests:

In[2]:=
ResourceFunction["GraphMouseMagnify"][
 GraphPlot[Table[i -> Mod[i^3, 162], {i, 0, 602}], ImageSize -> 500], 7.5, .7]
Out[2]=

Visualize a dense graph of the files in your installation directory:

In[3]:=
files = Flatten[
   Rest[NestList[
     Union[Flatten[
        Thread[# -> FileNames["*", #]] & /@ Last /@ #]] &, {"" -> $InstallationDirectory}, 3]]];
g = Graph[files, GraphLayout -> "BalloonEmbedding", ImageSize -> 500];
ResourceFunction["GraphMouseMagnify"][g, 13, .3]
Out[3]=

Change the parameters of zoom and radius:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/f0c03109-06ba-4e49-a45d-a570f65cb4a2"]
In[5]:=
Manipulate[
 ResourceFunction["GraphMouseMagnify"][graph, magnify, radius],
 {graph, Map[# -> Thumbnail[#, 100] &, examples]}, {{magnify, 4}, 1, 10, Appearance -> "Labeled"}, {{radius, .5}, 0.1, 3, Appearance -> "Labeled"}
 ]
Out[5]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 08 May 2020

Related Resources

License Information