This is because the graph is relabelled before being send to plot. You must 
give the new labels as values for the coloring dict.

sage: D = Poset(( divisors(12), attrcall("divides") ))
sage: mb={x:D.mobius_function(x, D.top()) for x in D}
sage: labels={x:(x, mb[x]) for x in D} 
sage: v_colors={"red": [e for e in D if mb[e]>0], "gray": [e for e in D if 
mb[e]==0], "blue": [e for e in D if mb[e]<0]}
sage: v_colors={"red": [labels[e] for e in D if mb[e]>0], "gray": 
[labels[e] for e in D if mb[e]==0], "blue": [labels[e] for e in D if 
mb[e]<0]}
sage: D.plot(element_labels=labels, vertex_colors=v_colors, 
vertex_shape="s", vertex_size=2000, figsize=6) 


Le jeudi 28 mai 2015 15:15:17 UTC+2, Jori Mäntysalo a écrit :
>
> After 
>
> D = Poset(( divisors(12), attrcall("divides") )) 
> mb={x:D.mobius_function(x, D.top()) for x in D} 
> labels={x:(x, mb[x]) for x in D} 
> v_colors={"red": [e for e in D if mb[e]>0], "gray": [e for e in D if 
> mb[e]==0], "blue": [e for e in D if mb[e]<0]} 
>
> it seems that 
>
> D.plot(element_labels=labels) 
> and 
> D.plot(vertex_colors=v_colors, vertex_shape="s", vertex_size=2000, 
> figsize=6) 
>
> works, but 
>
> D.plot(element_labels=labels, vertex_colors=v_colors, vertex_shape="s", 
> vertex_size=2000, figsize=6) 
>
> says 
>
> Traceback (click to the left of this block for traceback) 
> ... 
> KeyError: 4 
>
> Why so? 
>
> -- 
> Jori Mäntysalo 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to