Skip to content

Fix Error when calling .get_number_mobjects() with no arguments in NumberLine #4248

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
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

irvanalhaq9
Copy link
Contributor

@irvanalhaq9 irvanalhaq9 commented May 13, 2025

Overview: What does this pull request change?

Fix #4244

Motivation and Explanation: Why and how do your changes improve the library?

Calling get_number_mobjects() in NumberLine without any arguments caused error.
This PR resolves this issue (see: #4244).

Changes

  • Introduced method get_numbers_to_display():
    • Extracted from the logic previously embedded in add_numbers().
  • Updated get_number_mobjects():
    • Uses get_numbers_to_display() when numbers is not provided.
  • Simplified add_numbers():
    • Moved the logic for determining which numbers to include and which numbers to exclude to the get_numbers_to_display() method. This allows add_number() to focus only on adding the number objects to the axis.
    • Delegates label creation to get_number_mobjects().
    • Removed redundant checks of font_size and label_constructor, as these are already handled inside get_number_mobject().

Links to added or changed documentation pages

No changes in the documentation: https://manimce--4248.org.readthedocs.build/en/4248/reference/manim.mobject.graphing.number_line.NumberLine.html#manim.mobject.graphing.number_line.NumberLine

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

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