Skip to content

Plotting issue #4215

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

Open
harshpundhir opened this issue Apr 7, 2025 · 1 comment
Open

Plotting issue #4215

harshpundhir opened this issue Apr 7, 2025 · 1 comment

Comments

@harshpundhir
Copy link

harshpundhir commented Apr 7, 2025

Description of bug / unexpected behavior

error -> Exception: Not sure how you reached here, please file a bug report at https://github.com/ManimCommunity/manim/issues/new/choose

Expected behavior

The curve tangent motion

How to reproduce the issue

Code for reproducing the problem
class MathScene3(Scene):
    def construct(self):
        ax = Axes()
        sine = ax.plot(np.log, color=RED)
        alpha = ValueTracker(0)
        point = always_redraw(
            lambda: Dot(
                sine.point_from_proportion(alpha.get_value()),
                color=BLUE
            )
        )
        tangent = always_redraw(
            lambda: TangentLine(
                sine,
                alpha=alpha.get_value(),
                color=BLUE_A,
                length=4
            )
        )
        self.add(ax, sine, point, tangent)
        self.play(alpha.animate.set_value(1), rate_func=linear, run_time=4)

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, macOS sequoia
  • RAM:
  • Python version (python/py/python3 --version):
  • Installed modules (provide output from pip list):
Exception: Not sure how you reached here, please file a bug report at https://github.com/ManimCommunity/manim/issues/new/choose
LaTeX details
  • LaTeX distribution (e.g. TeX Live 2020):
  • Installed LaTeX packages:

Additional comments

@uwezi
Copy link
Contributor

uwezi commented Apr 7, 2025

The logarithmic function np.log(x) is not defined for values of x <= 0
Apparently the .plot function is not evaluated before you are trying to access the starting point.

Just set an appropriate interval for the plot:

class MathScene3(Scene):
    def construct(self):
        ax = Axes()
        sine = ax.plot(np.log, color=RED, x_range=[1e-2,6,1e-2])
        alpha = ValueTracker(0)
        point = always_redraw(
            lambda: Dot(
                sine.point_from_proportion(alpha.get_value()),
                color=BLUE
            )
        )
        tangent = always_redraw(
            lambda: TangentLine(
                sine,
                alpha=alpha.get_value(),
                color=BLUE_A,
                length=4
            )
        )
        self.add(ax, sine, point, tangent)
        self.play(alpha.animate.set_value(1), rate_func=linear, run_time=4)
MathScene3.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants