# Is there any graph / graph plotting package that allow edges having different color and length based on its identity and weight?

**URL:** <https://discourse.julialang.org/t/is-there-any-graph-graph-plotting-package-that-allow-edges-having-different-color-and-length-based-on-its-identity-and-weight/45982>\
**Category:** Graphs\
**Tags:** plotting, graphs\
**Created:** [September 3, 2020, 2:05am UTC](https://discourse.julialang.org/t/is-there-any-graph-graph-plotting-package-that-allow-edges-having-different-color-and-length-based-on-its-identity-and-weight/45982 "2020-09-03T02:05:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [September 3, 2020, 2:05am UTC](https://discourse.julialang.org/t/is-there-any-graph-graph-plotting-package-that-allow-edges-having-different-color-and-length-based-on-its-identity-and-weight/45982/1 "2020-09-03T02:05:58Z")

</div>

Usecase: Displaying the architecture of block copolymers. Block copolymers consist of many blocks each of which contains identical monomers and are connected by covalent bond at their joints. I think the natural way to describe such architecture is to use a graph. Each block can be viewed as an edge and nodes are free ends of blocks and their joints. Block can have a type (can be identified by a color) and a length (how many monomers they have).

Typical architectures can be linear, star, cycle, comb, etc. as shown in the following image.

![ga_APS005](https://global.discourse-cdn.com/julialang/original/3X/9/3/93950790f99de49ec5c03e40754915b4aec2e30a.gif)

Does anyone know if there is such a graph package to describe and plot these architeture. If edges (blocks) can be plotted as curves, it will be even better! Thanks!

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [September 3, 2020, 2:07am UTC](https://discourse.julialang.org/t/is-there-any-graph-graph-plotting-package-that-allow-edges-having-different-color-and-length-based-on-its-identity-and-weight/45982/2 "2020-09-03T02:07:01Z")

</div>

Canonical ones seems like Graphviz and mermaid, but I am not sure if they have up to date bindings in Julia. Maybe be via PyCall.jl

Not 100% sure.

---

<div class="post-metadata">

**Author:** ![liuyxpp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liuyxpp/32/9870_2.png) [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Post date:** [September 6, 2020, 8:55am UTC](https://discourse.julialang.org/t/is-there-any-graph-graph-plotting-package-that-allow-edges-having-different-color-and-length-based-on-its-identity-and-weight/45982/3 "2020-09-06T08:55:23Z")

</div>

I have found the TikzGraphs package which wraps Tikz/Pgf really powerful. It satisfies most of what I want to do except I cannot figure out how to specify the length of each edge according to its weight. Following image is what I have achieved so far. Check out my codes here in [Polymer.jl](https://github.com/liuyxpp/Polymer.jl).

![testgraph](https://global.discourse-cdn.com/julialang/original/3X/1/6/16776f54c0f865ac098b4f515100c479e286ca55.png)
