ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 24 Apr 2020 23:58:54 +0200Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of posethttps://ask.sagemath.org/question/50995/attribute-error-graphics-object-has-no-attribute-get_pos-with-plotting-hasse-diagram-of-poset/So I am trying to obtain the position dictionary used for displaying a poset P that can be used in the plotting of the Hasse diagram of P through the hasse_diagram() function.
To clarify, if I run the following code:
P = posets.BooleanLattice(3)
P.plot()
G = P.hasse_diagram().to_undirected()
G.plot()
The locations of the vertices of G do not line up with where the corresponding elements of the poset were. I know that we can save the position dictionary for graphs, but for whatever reason, I'm struggling with obtaining the position dictionary of elements in a poset. (With the specific posets I am working with, maintaining the position when obtaining the undirected Hasse diagram is important because I need a particular planar embedding which is not being preserved if I simply use the hasse_diagram() function in its canned form).
In the finite posets SageMath documentation, the `plot()` function says that it also accepts all options of `GenericGraph.plot` which should include the `save_pos` option and `get_pos()`. However, when I run
P = posets.BooleanLattice(3)
Pplot = P.plot(save_pos=True)
G = P.hasse_diagram().to_undirected()
position = Pplot.get_pos()
G.plot(pos = position)
I get an attribute error:
Error in lines 4-4
Traceback (most recent call last):
File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute
flags=compile_flags), namespace, locals)
File "", line 1, in <module>
AttributeError: 'Graphics' object has no attribute 'get_pos'
Is there any way to extract a position dictionary of a graphics object corresponding to the Hasse diagram of a poset?DerekHFri, 24 Apr 2020 23:58:54 +0200https://ask.sagemath.org/question/50995/