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/Specify heights in Poset.plothttps://ask.sagemath.org/question/37756/specify-heights-in-posetplot/ Hi, I'm relatively new to Python and SAGE so please make it simple :)
Basically, I work with posets that are not ranked and I want to plot their Hasse Diagram. For the moment, I use Poset.plot() to display it but I can change to hasse.diagram().plot() if necessary.
My problem is the following : The posets that I work with come with an extra function that associate to every set an integer. Is there a way to use this function to specify the heights of the sets in my plot and not the default one ?
Thank you MthGThu, 01 Jun 2017 11:01:19 +0200https://ask.sagemath.org/question/37756/Poset plot is upside-downhttps://ask.sagemath.org/question/25359/poset-plot-is-upside-down/ Tried the following in smc
X = (24).divisors()
R = [(a,b) for a in X for b in X if a.divides(b)]
D = Poset([X,R])
D.plot()
The resulting plot is upside-down; that is "1" is at the top and "24" at the bottom.
How can I fix this?mgassMon, 29 Dec 2014 17:01:23 +0100https://ask.sagemath.org/question/25359/Orientation of poset plot in Sage 6.3 vs 6.4https://ask.sagemath.org/question/25192/orientation-of-poset-plot-in-sage-63-vs-64/In older versions of Sage (6.3 and below), plotting a poset (or an acyclic graph with layout = "acyclic") gives a directed graph with arrows pointing up.
However, it seems like in Sage 6.4, the arrows now point down (and the bottom element appears at the top).
Is this a bug? Or are there any options I can tweak to reverse the orientation? I would expect the "correct" behaviour to be the one with the arrows pointing up; the Sage reference on [layout_acyclic](http://www.sagemath.org/doc/reference/graphs/sage/graphs/digraph.html#sage.graphs.digraph.DiGraph.layout_acyclic) seems to agree.
(I noticed the discrepancy while running Sage 6.3 on the [Sage Cell Server](http://sagecell.sagemath.org/) and Sage 6.4 on [Sagemath Cloud](https://cloud.sagemath.com/))
Here's some code you can try:
Poset({0:[2],1:[2],2:[]}).show()ZeWed, 10 Dec 2014 10:07:32 +0100https://ask.sagemath.org/question/25192/how to plot poset and subposet in a graph?https://ask.sagemath.org/question/10937/how-to-plot-poset-and-subposet-in-a-graph/hot to put poset and subposet and order_filter and order_ideal in one graph,but different color?
PP = Posets(6)[18];show(PP,vertex_size=100,vertex_colors='yellow');
Q = PP.subposet([2,4]);Q;show(Q,vertex_size=100,vertex_colors='green')
PP.order_filter([3,2]);PP.order_ideal([4,3])cjshMon, 20 Jan 2014 03:13:46 +0100https://ask.sagemath.org/question/10937/png scale of Posets and order from left ro righthttps://ask.sagemath.org/question/10717/png-scale-of-posets-and-order-from-left-ro-right/Hi to all,
I am doing a project with Posets in Sage. What I want is to create Posets and O(P) to view a pattern based on the created (png) Posets, so that I can generalize the behavior of O(P). I have created the Posets, but it changes the order of the numbers in the Poset, which makes difficult to see the pattern. ( I cant upload images because of my Karma... :/)
For example, the labeling of the posets go, from left to right (when there are more nodes):
level Poset (connected)
2 4
1 3 2
0 1
1- How I can force to draw the picture (the png) to go in the ascending order, from left to right?
Also, when the posets have 12 or more elements, they are not readable, the labels are inserted inside the others...
2- How I can change the scale of the nodes and the scale of the arrows to be more readable??
Thak you!
Note: I am using
x = P2.plot() # P2 is a Poset
x.save("myfile.png") # save the Poset
ShariffSat, 09 Nov 2013 10:33:41 +0100https://ask.sagemath.org/question/10717/