# Handling network plots with Julia

**URL:** <https://discourse.julialang.org/t/handling-network-plots-with-julia/30949>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [November 11, 2019, 12:02pm UTC](https://discourse.julialang.org/t/handling-network-plots-with-julia/30949 "2019-11-11T12:02:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rad1um](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rad1um/32/8483_2.png) [@rad1um](https://discourse.julialang.org/u/rad1um)\
**Post date:** [November 11, 2019, 12:02pm UTC](https://discourse.julialang.org/t/handling-network-plots-with-julia/30949/1 "2019-11-11T12:02:27Z")

</div>

Hello everyone,  
I currently have to plot a lot of networks for my master thesis. Since the common graph tools for networks in julia (e.g. lightgraph, gplot, graphrecipes,…) are far from being as mature as python’s networkx is I decided to import networkx via PyCall.

```julia
using PyCall
nx = pyimport("networkx")

```

Normally I use plots for plotting, but with Networkx I have to use PyPlot.  
Is there a way to handle PyPlot figures with Plots? What I would like to do exactly is to create an animation from PyPlot figures with Plots, like:

```julia
using PyPlot
using Plots
pyplot() #change backend

#create graph and get positional information
g = nx.hexagonal_lattice_graph(3, 3)
pos = nx.get_node_attributes(g, "pos")

@gif for i in 1:100
    PyPlot.figure()
    nodes = nx.draw_networkx_nodes(g, pos,
        node_color = [RGBA(0.0,0.0,rand(),1.0) for i in 1:nx.number_of_nodes(g)],
        cmap = PyPlot.get_cmap("twilight"),
    )
    edges = nx.draw_networkx_edges(g, pos)
    PyPlot.colorbar(nodes)
    PyPlot.draw()
end every 10

```

This gives me the Error message: `No current Plot/Subplot`

Since I can use pyplot as backend for Plots, I thought this should be theoretically possible. Does anyone have an idea?  
Another way to solve the problem would be to call PyPlot functions (like `draw()`) in Plots. Is that possible?
