ManimCommunity / ManimCommunity/manim

Coloring of vertex background in Graph()

Open
#3,070 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reproduction code in the issue with Manim and inspect how Graph constructs each vertex's background and label submobjects. Done means setting submobject[0]'s color changes only the vertex background, while setting submobject[1]'s color changes only the label.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.