Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axes and its submobjects does not respect passed colors #3633

Open
Ironman1905 opened this issue Feb 29, 2024 · 2 comments · May be fixed by #3727
Open

Axes and its submobjects does not respect passed colors #3633

Ironman1905 opened this issue Feb 29, 2024 · 2 comments · May be fixed by #3727
Labels
good first issue Good for newcomers issue:bug Something isn't working... For use in issues

Comments

@Ironman1905
Copy link

Description of bug / unexpected behavior

I set the background is white, but the numbers with Black color nearby the axis don't display

Expected behavior

I should see the black number label when background is white

How to reproduce the issue

Code for reproducing the problem
from manim import *
#from scipy.stats import norm
#import os
config.media_width="10%"
config.background_color="WHITE"
class Test(Scene):
    def construct(self):
       
       
        axes = Axes( x_range=[-1,8],y_range=[-1,70], 
                    #axis_config={"color": BLACK},
                    x_axis_config={"color": BLACK,
                                    "include_numbers": True,
                                   "decimal_number_config": {
                                    "color": BLACK,
                                   "num_decimal_places": 0 
                                     }
                                   }, 
                    y_axis_config={"color": BLACK,
                                   "include_ticks": False}
        )
        self.add(axes)
        redcolor=ManimColor.from_rgb([255,0,0])
        bluecolor=ManimColor.from_rgb([0,0,255])
        Parabola_graph=axes.plot(lambda x: x**3, color=bluecolor)
        line_graph=axes.plot(lambda x: 15*x+4, color=redcolor)
        self.play(Create(Parabola_graph), Create(line_graph),run_time=5)

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)):
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
PASTE HERE
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:
FFMPEG

Output of ffmpeg -version:

PASTE HERE

Additional comments

@behackl
Copy link
Member

behackl commented Apr 20, 2024

This is an issue with how coloring of Axes is handled during initialization of the object. The best solution (for now) is to take care of coloring in a second step, after creating the object:

from manim import *

config.background_color = WHITE

class Test(Scene):
    def construct(self):
        axes = Axes(x_range=[-1, 8], y_range=[-1, 70], 
            x_axis_config={
                "include_numbers": True,
                "decimal_number_config": {"num_decimal_places": 0}
            }, 
            y_axis_config={"include_ticks": False}
        )
        axes.set_color(BLACK)
        self.add(axes)
        redcolor = ManimColor.from_rgb([255,0,0])
        bluecolor = ManimColor.from_rgb([0,0,255])
        Parabola_graph = axes.plot(lambda x: x**3, color=bluecolor)
        line_graph = axes.plot(lambda x: 15*x+4, color=redcolor)
        self.play(Create(Parabola_graph), Create(line_graph), run_time=5)

@jherkenhoff
Copy link

+1
When animating the axis with e.g. self.play(Write(axes)), the numbers briefly show up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers issue:bug Something isn't working... For use in issues
Projects
Status: 🆕 New
3 participants