Graphs not rendering properly
- Linguagem predominante
- Python
- Estrelas
- 93.9k
- Forks
- 7.7k
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 4
Descrição
Hello, I've been recently trying out on Manimgl the code from example_scenes.py, and I've encountered that some graphs don't show up properly in the render. More concretely, there are patches of the curves that seem to be "skipped", or not rendered properly (particularly on the sine and parabolic graphs). I was't able to fix this. Below is the code and a screen recording of the graphs and the scene in question.
https://user-images.githubusercontent.com/64146682/119419163-06e7b500-bcd0-11eb-85d2-e7ae204ef5bc.mov
```
class GraphExample(Scene):
def construct(self):
self.wait(10)
axes = Axes((-3, 10), (-1, 8))
axes.add_coordinate_labels()
self.play(Write(axes, lag_ratio=0.01, run_time=1))
sin_graph = axes.get_graph(
lambda x: 2 * math.sin(x),
color=BLUE,
)
relu_graph = axes.get_graph(
lambda x: max(x, 0),
use_smoothing=False,
color=YELLOW,
)
step_graph = axes.get_graph(
lambda x: 2.0 if x > 3 else 1.0,
discontinuities=[3],
color=GREEN,
)
sin_label = axes.get_graph_label(sin_graph, "\\sin(x)")
relu_label = axes.get_graph_label(relu_graph, Text("ReLU"))
step_label = axes.get_graph_label(step_graph, Text("Step"), x=4)
self.play(
ShowCreation(sin_graph),
FadeIn(sin_label, RIGHT),
)
self.wait(2)
self.play(
ReplacementTransform(sin_graph, relu_graph),
FadeTransform(sin_label, relu_label),
)
self.wait()
self.play(
ReplacementTransform(relu_graph, step_graph),
FadeTransform(relu_label, step_label),
)
self.wait()
parabola = axes.get_graph(lambda x: 0.25 * x**2)
parabola.set_stroke(BLUE)
self.play(
FadeOut(step_graph),
FadeOut(step_label),
ShowCreation(parabola)
)
self.wait()
dot = Dot(color=RED)
dot.move_to(axes.i2gp(2, parabola))
self.play(FadeIn(dot, scale=0.5))
x_tracker = ValueTracker(2)
f_always(
dot.move_to,
lambda: axes.i2gp(x_tracker.get_value(), parabola)
)
self.play(x_tracker.animate.set_value(4), run_time=3)
self.play(x_tracker.animate.set_value(-2), run_time=3)
self.wait()
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
O problema está em example_scenes.py, especificamente na cena GraphExample. Olhe o método Axes.get_graph e o pipeline de renderização para curvas de gráficos. O vídeo mostra trechos pulados nos gráficos de seno e parabólico. Comece executando o código fornecido para reproduzir o problema, então examine a lógica de graph plotting e line rendering no módulo graph do manim.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Domínio
- computer-graphics
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 55/100