Color nodes of poset
I have a poset Q and an element alpha[4] of Q. If I type "alpha[4] in Q", Sage correctly responds "True".
However, when I ask Sage to plot Q with alpha[4] in a special color, I get a KeyError that looks like it can no longer identify alpha[4] as an element of Q. What is going on?
I can't attach screenshots, so here's the error message in text:
Q.plot(element_colors={"blue":[alpha[4]]})
KeyError Traceback (most recent call last) <ipython-input-27-a224aeb4e328> in <module> ----> 1 Q.plot(element_colors={"blue":[alpha[Integer(4)]]})
/ext/sage/9.4/local/lib/python3.9/site-packages/sage/combinat/posets/posets.py in plot(self, label_elements, element_labels, layout, cover_labels, *kwds) 2061 cover_labels = False 2062 -> 2063 return graph.plot(vertex_labels=label_elements, 2064 edge_labels=cover_labels, 2065 layout=layout, /ext/sage/9.4/local/lib/python3.9/site-packages/sage/misc/decorators.py in wrapper(args, *kwds) 489 options['__original_opts'] = kwds 490 options.update(kwds) --> 491 return func(args, *options) 492 493 #Add the options specified by @options to the signature of the wrapped /ext/sage/9.4/local/lib/python3.9/site-packages/sage/graphs/generic_graph.py in plot(self, *options) 19991 ['black', 'purple', 'yellow', 'yellow'] 19992 """
19993 return self.graphplot(*options).plot() 19994 19995 def show(self, method="matplotlib", *kwds): /ext/sage/9.4/local/lib/python3.9/site-packages/sage/graphs/generic_graph.py in graphplot(self, *options) 19639 """ 19640 from sage.graphs.graph_plot import GraphPlot 19641 return GraphPlot(graph=self, options=options) 19642 19643 def _rich_repr_(self, display_manager, *kwds): /ext/sage/9.4/local/lib/python3.9/site-packages/sage/graphs/graph_plot.py in __init__(self, graph, options) 304 305 self.set_pos() --> 306 self.set_vertices() 307 self.set_edges() 308 /ext/sage/9.4/local/lib/python3.9/site-packages/sage/graphs/graph_plot.py in set_vertices(self, **vertex_options) 492 colors = [] 493 for i in vertex_colors: --> 494 pos.extend([self._pos[j] for j in vertex_colors[i]]) 495 colors.extend([i] * len(vertex_colors[i])) 496 /ext/sage/9.4/local/lib/python3.9/site-packages/sage/graphs/graph_plot.py in <listcomp>(.0) 492 colors = [] 493 for i in vertex_colors: --> 494 pos.extend([self._pos[j] for j in vertex_colors[i]]) 495 colors.extend([i] * len(vertex_colors[i])) 496 KeyError: alpha[4]
possibly related: although "alpha[4] in Q" is True, "alpha[4] in list(Q)" is apparently False. I think this must be a bug?