Hi again,

Thank you for the detailed description. I have found the part of the code that I need to change. It is the variable pi4 in get_label_position() what I needed to make smaller.

Best,
Jose


On 21/12/2016 10:22, Tamas Nepusz wrote:
Hi,

Edge drawing is implemented in specialized edge drawer classes in igraph/drawing/edge.py. They all derive from an abstract base class called AbstractEdgeDrawer, which defines a function named get_label_position() that returns the position of the label for an edge. The default edge drawer used by igraph is called ArrowEdgeDrawer.

You can therefore simply implement a new class derived from ArrowEdgeDrawer, override its get_label_position() method, and then use this custom edge drawer when plotting the graph as follows:

from igraph.drawing.edge import ArrowEdgeDrawer
from igraph.drawing.graph import DefaultGraphDrawer
from functools import partial

class CustomEdgeDrawer(ArrowEdgeDrawer):
    # do your magic here
    pass

my_drawer = partial(DefaultGraphDrawer, edge_drawer_factory=CustomEdgeDrawer)
plot(graph, drawer_factory=my_drawer)

(Haven't tested it, but it should work).

All the best,

T.

On Wed, Dec 21, 2016 at 10:03 AM, José Juan Almagro Armenteros <[email protected] <mailto:[email protected]>> wrote:

    Hello,

    Thank you for the info. Could you indicate which function defines
    the position of the edge labels? At least I would like to change
    the default positions for all the labels.

    Best,
    Jose


    On 20/12/2016 21:10, Tamas Nepusz wrote:
    Hi,

    Unfortunately it is not possible to change the position of edge
    labels with the current plotting engine.

    All the best,

    T.

    On Tue, Dec 20, 2016 at 6:23 PM, José Juan Almagro Armenteros
    <[email protected] <mailto:[email protected]>> wrote:

        Hello,

        I have just started using this packages and I have generated
        a nice tree plot. However, I haven't been able to change the
        position of the edge labels and there is no documentation
        about it. Do you know how could I do this?

        Best,
        Jose


        _______________________________________________
        igraph-help mailing list
        [email protected] <mailto:[email protected]>
        https://lists.nongnu.org/mailman/listinfo/igraph-help
        <https://lists.nongnu.org/mailman/listinfo/igraph-help>




    _______________________________________________
    igraph-help mailing list
    [email protected] <mailto:[email protected]>
    https://lists.nongnu.org/mailman/listinfo/igraph-help
    <https://lists.nongnu.org/mailman/listinfo/igraph-help>

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to