Skip to content

Graph: node labels' color defaulting to white instead of black #4500

@Schefflera-Arboricola

Description

@Schefflera-Arboricola

Description of bug / unexpected behavior

when labels=True, the node labels are white TeX on white nodes-- and therefore invisible.
in the doc example LabeledModifiedGraph also you can see the labels are not visible for white nodes, but only for the red node -- https://docs.manim.community/en/stable/reference/manim.mobject.graph.Graph.html

Expected behavior

Node labels' color should default to black and should be visible

How to reproduce the issue

Code for reproducing the problem
from manim import *
import networkx as nx

class MovingVertices(Scene):
    def construct(self):
        vertices = [1, 2, 3, 4]
        edges = [(1, 2), (2, 3), (3, 4), (1, 3), (1, 4)]
        # labels = "1234"
        G = nx.Graph(edges)
        g = Graph.from_networkx(  # same behaviour when using manim's Graph(...)
            G,
            # labels=True                                  # --> white labels on white node dots
            labels={
                v: MathTex(v, fill_color=BLACK) for v in vertices   # --> white labels -- runs inside manim
                # v: MathTex(v, color=BLACK) for v in vertices      # --> works -- black labels -- could be a potential fix (`fill_color` --> `color`)
                # i: label for i, label in zip(vertices, labels)       # --> works -- black labels
            }
        )

        self.play(Create(g))
        self.wait()

Additional media files

Images/GIFs

Logs

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

System specifications

System Details
  • OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): macOS Tahoe 26.1
  • RAM:
  • Python version (python/py/python3 --version): 3.12
  • Installed modules (provide output from pip list):
Package                Version
---------------------- -----------
av                     13.1.0
beautifulsoup4         4.14.3
click                  8.3.1
cloup                  3.0.8
Cython                 3.2.2
decorator              5.2.1
glcontext              3.0.0
iniconfig              2.3.0
isosurfaces            0.1.2
manim                  0.19.1
ManimPango             0.6.1
mapbox_earcut          2.0.0
markdown-it-py         4.0.0
mdurl                  0.1.2
moderngl               5.12.0
moderngl-window        3.1.1
networkx               3.7rc0.dev0
numpy                  2.3.5
packaging              25.0
pillow                 12.0.0
pip                    24.0
pluggy                 1.6.0
pycairo                1.29.0
pydub                  0.25.1
pyglet                 2.1.11
pyglm                  2.8.3
Pygments               2.19.2
pyobjc-core            12.1
pyobjc-framework-Cocoa 12.1
pytest                 9.0.1
pytest-order           1.3.0
rich                   14.2.0
scipy                  1.16.3
screeninfo             0.8.1
skia-pathops           0.9.0
soupsieve              2.8
srt                    3.5.3
svgelements            1.9.6
tqdm                   4.67.1
typing_extensions      4.15.0
watchdog               6.0.0

[notice] A new release of pip is available: 24.0 -> 25.3
[notice] To update, run: pip install --upgrade pip
LaTeX details

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions