LaTeX printing Hasse diagram

80 views
Skip to first unread message

Trevor Karn

unread,
Apr 14, 2022, 9:17:11 PM4/14/22
to sage-devel
Hi all,

I have tried to create a nice image of a Hasse diagram (of the set partitions of {1,2,3,4}) using the command `view(Poset((SetPartitions(4), lambda A,B: A in B.refinements())))`

However, when I try, things come out looking a bit messy (image attached). The problem doesn't seem to be with the latex compiler on my end, since (e.g.) the complete bipartite graph comes out looking just fine using `view(graphs.CompleteBipartiteGraph(3,3))`.

Does this seem like a bug, or are there some configurations wrong on my end?

Thanks,
Trevor


ugly-hasse.pdf

Trevor Karn

unread,
Apr 14, 2022, 9:19:32 PM4/14/22
to sage-devel
Sorry, I should have added: I'm using 9.6.beta5 on MacOS Monterey v. 12.2.

Sébastien Labbé

unread,
Apr 15, 2022, 8:56:35 AM4/15/22
to sage-devel
On 9.6.rc0, I am not able to reproduce the issue. The command `view(Poset((SetPartitions(4), lambda A,B: A in B.refinements())))` produce a nice looking picture level by level.
Sébastien

Trevor Karn

unread,
Apr 15, 2022, 9:53:53 AM4/15/22
to sage-...@googlegroups.com
Thanks Sébastien, I’ll upgrade and see if that fixes it.



--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/rV9qfPdtelU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b7bf3ffd-383d-45a5-93bf-31ac274c4cc2n%40googlegroups.com.
--
Best,

Trevor

Sébastien Labbé

unread,
Apr 15, 2022, 10:54:52 AM4/15/22
to sage-devel
Also, now that #20343 is in Sage (9.6.beta7). If graphviz is installed and  `sage -i dot2tex` as well, one can do:

sage: P = Poset((SetPartitions(4), lambda A,B: A in B.refinements()))
sage: from sage.misc.latex_standalone import TikzPicture
sage: TikzPicture.from_poset(P, prog='dot').pdf()

The dot graphviz program places the nodes in a tree like form. Valid values for prog are ['dot', 'twopi', 'neato', 'circo', 'fdp'], but they do not create as nice pictures:

sage: TikzPicture.from_poset(P, prog='neato').pdf()

The `from_poset` method is marked as experimental and prints warnings when you use it since it will move in the future within the class Poset. See https://trac.sagemath.org/ticket/33002

Trevor Karn

unread,
Apr 20, 2022, 5:29:17 PM4/20/22
to sage-devel
Thanks so much, Sébastien. I `sage -i dot2tex`-ed on 9.6.beta5 and that fixed the problem. Is this something that should be included in the documentation? If so, I can open a ticket and add it, but where do you suggest I do so? The documentation for `view()` seems like too generic of a spot, and as far as I can tell, there is no `Poset.view` method in the documentation. One option would be to add a view method, but that may conflict with the show method and cause confusion. 
Reply all
Reply to author
Forward
0 new messages