igraph-help
[Top][All Lists]
Advanced

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

[igraph] Dot labels with newlines


From: Justin McCann
Subject: [igraph] Dot labels with newlines
Date: Thu, 2 Feb 2012 12:03:36 -0500

Does anyone have any recommendations for putting newlines (\n) into
labels in a way that will make dot happy?

Whenever I call g.write_dotfile(filename) with a graph that contains
labels with newlines, the string formatting gets in the way a little
bit.

For example
   v['label'] = "foo\nbar"

Ends up getting rendered in the dot file as
   1 [label="foo
bar"]

which Dot doesn't like, and truncates at the end of the line (just
"foo" gets rendered).

If I try
   v['label'] = r"foo\nbar"
or
   v['label'] = "foo\\nbar"

the dotfile ends up with
  1 [label="foo\\nbar"]

Which dot renders as the string "foo\nbar" in the resulting graph image file.

I've also tried HTML-formatted labels, but igraph puts them into the
dotfile in double-quotes, and it needs to be in curly braces for HTML
rendering.

Any ideas?

Thanks!
    Justin



reply via email to

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