manim icon indicating copy to clipboard operation
manim copied to clipboard

Coloring of vertex background in Graph()

Open uwezi opened this issue 3 years ago • 2 comments

Description of bug / unexpected behavior

When trying to change the background color of a vertex in a Graph() object, the color of the label changes as well. On the other hand the color of the label can be changed without changing the background color.

Expected behavior

The vertex sub-mobject consists of a background with index 0 and a label with index 1. Changing the color for the submobject[0] should not affect the color of submobject[1]

How to reproduce the issue

Code for reproducing the problem
class LMG(Scene):
    def construct(self):
        vertices = ["a", 2, 3, 4, 5, 6, 7, 8]
        edges = [("a", 7), ("a", 8), (2, 3), (2, 4), (2, 5),
                 (2, 8), (3, 4), (6, "a"), (6, 2),
                 (6, 3), (7, 2), (7, 4)]
        g = Graph(vertices, edges, layout="circular", layout_scale=3,
                  labels=True, vertex_config={7: {"fill_color": RED}},
                  edge_config={("a", 7): {"stroke_color": RED},
                               (2, 7): {"stroke_color": RED},
                               (4, 7): {"stroke_color": RED}})
        self.add(g)
        
        self.play(
            g[("a")][0].animate.set_color(BLUE), # both circle and text change color
            run_time=1
        ) 
        self.wait(2)  
        self.play(
            g[("a")][1].animate.set_color(BLACK), # only the label changes color
            run_time=1
        ) 
        self.wait(2)  

Logs

Terminal output
PASTE HERE OR PROVIDE LINK TO https://pastebin.com/ OR SIMILAR

System specifications

System Details - Manim v0.17.1 - Windows 10 - RAM: - Python version 3.9.8

uwezi avatar Dec 10 '22 23:12 uwezi

I am taking a look at this.

BrenoPin avatar Dec 02 '23 18:12 BrenoPin

Sorry, I was trying this issue as a first-time contribution, but I am not sure if this is a Manim issue or a usage issue. The code handling this seems to be working correctly, so I am not sure if anything should be changed.

Could another developer take a closer look at this?

BrenoPin avatar Dec 12 '23 02:12 BrenoPin