Skip to content

Renamed get_graph and its variants to :meth:~.CoordinateSystem.plot #2187

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

Merged
merged 15 commits into from
Oct 31, 2021
Merged

Renamed get_graph and its variants to :meth:~.CoordinateSystem.plot #2187

merged 15 commits into from
Oct 31, 2021

Conversation

icedcoffeeee
Copy link
Collaborator

@icedcoffeeee icedcoffeeee commented Oct 11, 2021

Overview: What does this pull request change?

  • Renamed:
    • get_graph to :meth:~.CoordinateSystem.plot
    • get_implicit_curve to :meth:~.CoordinateSystem.plot_implicit_curve
    • get_parametric_curve to :meth:~.CoordinateSystem.plot_parametric_curve
    • get_line_graph to :meth:~.CoordinateSystem.plot_line_graph
    • get_derivative_graph to :meth:~.CoordinateSystem.plot_derivative_graph
  • Deprecated their previous names

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

Links to added or changed documentation pages

Further Information and Comments

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

Copy link
Member

@hydrobeam hydrobeam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested extending deprecation date to v0.13.0, + the renaming should be applied where get_x are used in the docs too. But I do support the name change! 👍

@kolibril13
Copy link
Member

Looks good to me in general!
plot is more intuitive than get_graph
Just one thing to note:
In manim this wont show the graph directly

ax.plot(lambda x: x ** 2, color=PURPLE_B)

In matplotlib, this would show the graph directly:

ax.plot(x, y)

That is not a big issue, but might cause confusion.
Suggestion:
Should we, maybe in a future pr, directly add the plot as an submobject to the ax mobject?

@Darylgolden
Copy link
Member

Looks good to me in general! plot is more intuitive than get_graph Just one thing to note: In manim this wont show the graph directly

ax.plot(lambda x: x ** 2, color=PURPLE_B)

In matplotlib, this would show the graph directly:

ax.plot(x, y)

That is not a big issue, but might cause confusion. Suggestion: Should we, maybe in a future pr, directly add the plot as an submobject to the ax mobject?

Not sure, but since this isn't directly related to this PR, maybe open a new discussion/issue?

Copy link
Member

@Darylgolden Darylgolden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still some remnants of the old syntax here and here (there may be more, I haven't checked exhaustively). Could you go over it again with Ctrl+F to make sure there isn't anything missed?

@icedcoffeeee
Copy link
Collaborator Author

Still some remnants of the old syntax

Ah my bad, I went only went through the 'manim' subfolder 😅. It should be clear now

Copy link
Member

@kolibril13 kolibril13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but since this isn't directly related to this PR, maybe open a new discussion/issue?

Yes, that can be discussed in the future, for now this looks good to me!

@hydrobeam
Copy link
Member

Should get_vertical_lines_to_graph/ get_t_label and all related methods in coordinate_system.py etc... remove mentions to graph and instead use curve instead? Since we're renaming get_graph to plot, this feels appropriate to me. It'd make more sense to unify the usage of graph/curve since they're currently used interchangably throughout the file/docs.

@icedcoffeeee
Copy link
Collaborator Author

@hydrobeam

remove mentions to graph and instead use curve instead?

I disagree, the term 'curve' brings a very general sense as opposed to 'graph' which is closely related to function plotting. I think of .plot() as the act of plotting which in turn returns a graph. .get_implicit_curve() on the other hand, just so happens to have very different meanings between 'implicit graph' and 'implicit curve'.

That being said, IMO the current naming of curves and graphs are already pretty understandable.

Copy link
Member

@Darylgolden Darylgolden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you resolve the merge conflicts?

Copy link
Member

@christopher-besch christopher-besch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just gave it a quick grep -R and found this and this.
Besides that this looks good.

@icedcoffeeee
Copy link
Collaborator Author

found this and this.

Thanks! They were probably added sometime after I left this PR and I didn't notice

@behackl behackl dismissed stale reviews from Darylgolden and hydrobeam October 31, 2021 09:52

Replacements have been made.

Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I also (strongly) support renaming get_graph to plot.

@behackl behackl enabled auto-merge (squash) October 31, 2021 09:54
@behackl behackl merged commit c874636 into ManimCommunity:main Oct 31, 2021
@icedcoffeeee icedcoffeeee deleted the rename-get-graph branch October 31, 2021 10:02
@behackl behackl added the pr:deprecation Deprecation, or removal of deprecated code label Nov 1, 2021
@behackl behackl changed the title Renamed get_graph (and the like) to plot Renamed get_graph and its variants to :meth:~.CoordinateSystem.plot Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:deprecation Deprecation, or removal of deprecated code
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants