3b1b / 3b1b/manim

"get_area_under_graph" Generates fragments when using "color_gradient"

Offen
#2,364 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
93.8k
Forks
7.7k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

### Describe the bug
When trying to use a "color_gradient" to style the area under a graph, the area seems to "leak" from where it should be, generating very weird look

**Code**:
```
from manimlib import *
import numpy as np

class pauliMatrices(Scene):
def construct(self):

my_plane = NumberPlane((-6,6),(-10,10)).scale(.5)
my_plane.shift(RIGHT*3)

func = my_plane.get_graph(lambda x:0.1*(x-5)*x*(x+5), x_range=(-6,6), color=GREEN_B)

color_gradient = [BLUE, YELLOW]

area = my_plane.get_area_under_graph(func, (-5,5), color_gradient, 1)
label=Tex("f(x)=0.1x(x-5)(x+5)").next_to(my_plane, UP, buff=0.2)

horiz_line=Line(start=my_plane.c2p(0, func.underlying_function(-2)), end=my_plane.c2p(-2, func.underlying_function(-2)), stroke_color=YELLOW, stroke_width=10)

self.play(DrawBorderThenFill(my_plane))
self.play(ShowCreation(func), Write(label))
self.play(FadeIn(area))
```

**Wrong display or Error traceback**:

https://github.com/user-attachments/assets/f98236f9-a942-477e-a157-493b1a74852e

### Additional context
None

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.