igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Determining exact coordinates for a drawn graph in Python


From: Alexander Tsiatas
Subject: Re: [igraph] Determining exact coordinates for a drawn graph in Python
Date: Wed, 23 Jun 2010 15:54:23 -0400

Tamas,

Thanks for your help. What you said makes sense, but I think I have bigger problems than this. One of my specified coordinates is (0.006, 0.006), but the resulting picture does not place any point within 10 pixels of any of the image corners (where 20 is the max vertex size). Is there anything else that the plotter does to the coordinates when plotting them out? Also, my version of igraph doesn't seem to support the exact syntax you gave, but I've been using:
plot(G, bbox=(0, 0, width, height)).

-Alex

On Wed, Jun 23, 2010 at 2:34 PM, Tamas Nepusz <address@hidden> wrote:
Hello,

> I can draw the graph fine, but it seems like the coordinates that are specified do not end up being exactly the coordinates used - they must be scaled or stretched somehow, even when I use bbox=layout.bounding_box() in igraph.plot(). I thought that this would use my exact coordinates, since I am using the bounding box from my coordinates, but it seems like they are being modified somehow, and I can't figure out how exactly they are changed.
The plotting function also takes into account the maximal vertex size; in particular, it takes the specified width and height, creates a box that spans from (0,0) to (width,height), then shrinks the box with half the maximum vertex size to leave a margin of max_vertex_size/2. This is to ensure that even those vertices are shown completely that end up at the edges of the layout. So, if you have a pre-calculated layout with the exact pixel coordinates, you can try this:

max_vertex_size = 10
bbox = layout.bounding_box()
width, height = bbox.width + max_vertex_size, bbox.height + max_vertex_size
plot(your_graph, (width, height))

By expanding the width and height of the plotting canvas with the maximum vertex size in advance, you are compensating for the contraction of the bounding box by half the vertex size in advance. Hope this helps.

--
Tamas
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help


reply via email to

[Prev in Thread] Current Thread [Next in Thread]