First time here? Check out the FAQ!

Ask Your Question
1

plotting graphs, vertices on some graphs are very small

asked 0 years ago

micron gravatar image

I am plotting digraphs. I have raised the vertex size way more than I want to because I can barely see the vertices if: 1. the digraph has at least one set of vertices with an directed edge going both ways or 2. the digraph has loops. otherwise, they print with the vertex size I am specifying. Here's an example of the two types of graphs with small vertices and one with correct size:

g = DiGraph({1:[2], 3:[5]},loops=True)
gg = DiGraph({1:[3],3:[1]},loops=True)
ggg = DiGraph({1:[1]},loops=True)

plots = []
plots.append(gg.plot(layout='circular', vertex_size=600, vertex_labels=True, xmin = -2, xmax = 2, loop_size=.3))
plots.append(g.plot(layout='circular', vertex_size=600, vertex_labels=True, xmin = -2, xmax = 2, loop_size=.3))
plots.append(ggg.plot(layout='circular', vertex_size=600, vertex_labels=True, xmin = -2, xmax = 2, loop_size=.3))

graphics_array(plots).show()

Thanks for your help.

Preview: (hide)

Comments

These graphs looks fine when I look at them separately, so it looks more like an issue with graphics_array than the individual plots. Can you confirm?

John Palmieri gravatar imageJohn Palmieri ( 0 years ago )

Also, what happens if you remove/modify the xmin and xmax arguments? Can you get the pictures you want?

John Palmieri gravatar imageJohn Palmieri ( 0 years ago )

Thanks John. I am not convinced that the issue is with graphics_array alone. They seem a lot more uniformly sized when displayed separately but look again because the vertices on the first and third graphs are still ever so slightly smaller than the middle graph.

If I remove xmin,xmax, they are even more differently sized but with the two outer graphs having larger vertices compared to middle. If I make them have the same amount of vertices, and also remove the xmin,xmax, it helps a bit, (which probably depends more on the vertex positions than the amount of vertices being the same, I imagine..).

micron gravatar imagemicron ( 0 years ago )

here's more code to show the updates mentioned in previous comment.

V= [1,2,3,4]
g = DiGraph([V, [(1,2), (3,4)]],loops=True)
gg = DiGraph([V,[(1,3),(3,1)]],loops=True)
ggg = DiGraph([V,[(1,1)]],loops=True)
plots = []

plots.append(gg.plot(layout='circular', vertex_size=300, vertex_labels=True ))
plots.append(g.plot(layout='circular', vertex_size=300, vertex_labels=True))
plots.append(ggg.plot(layout='circular', vertex_size=300, vertex_labels=True))
graphics_array(plots).show()
gg.plot(layout='circular', vertex_size=600, vertex_labels=True, loop_size=.3)
g.plot(layout='circular', vertex_size=600, vertex_labels=True, loop_size=.3)
ggg.plot(layout='circular', vertex_size=600, vertex_labels=True, loop_size=.3)
micron gravatar imagemicron ( 0 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 0 years ago

Sébastien gravatar image

Alternatively, in the Jupyter notebook, if graphviz + dot2tex are installed, here is what you can obtain:

image description

It is a feature that could be added to TikzPicture module to create graphics array of tikzpictures using matrix of nodes for instance. Vincent Delecroix asked me once about that feature. Maybe if it is desirable, I could spend time soon on this feature.

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 57 times

Last updated: Mar 04