-
Notifications
You must be signed in to change notification settings - Fork 2.5k
enhance: Add background rectangle in Vector.coordinate_label based on keyword arg #1988
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
Conversation
icedcoffeeee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I glossed over your PR and left some comments
| shift_dir -= label.get_right() + DEFAULT_MOBJECT_TO_MOBJECT_BUFFER * RIGHT | ||
| label.shift(shift_dir) | ||
| label.set_color(color) | ||
| if show_bg_rec: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is redundant no? Passing add_background_rectangles_to_entries in Matrix already does these.
Cancel that, why don't you pass include_background_rectangle to Matrix instead of add_background_rectangles_to_entries and adding a BackgroundRectangle separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, that sounds better actually. Thanks!
I have made the change in the function.
| show_bg_rec | ||
| Display background rectangle for a number. | ||
| Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example for the method isn't showing up, as shown here. Could you fix that? The indentation of the manim code block isn't quite right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't quite get this one. I saw the page and yes the example is missing. But upon checking the indentation in the function docstring and committing, I couldn't pinpoint the exact issue that could be causing the missing example. I tried crosschecking with the other examples present in the script as well. Will try investigating a bit more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, I misjudged, the problem was at the .. manim keyword at the start of the example, it needs a double colon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, found it. There was some build issue too due to wrong variable name in the example. Fixed both. Am able to see the example in the link now.
|
thanks for the PR ! Could you :
Thanks ! |
Hello @huguesdevimeux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that colored background rectangles is a desired result.
at line 1623, you can make small change:
if show_bg_rect:
label[1:].set_color(color)
else:
label.set_color(color)
Hello @icedcoffeeee |
Technically, your first commit did bring the desired result. My suggestion of changes was just a mere simplification 😅 |
After some observation I found out that there wasn't any need of BackgroundRectangle Function and a separate if-else condition, I think only passing a parameter
|
I don't think so, it still gives a colored background rect under each element. Plus, personally when i pass |
Ok, so we actually need 2 different parameters one for the entries' background only, and one for the whole matrix. |
|
@huguesdevimeux @icedcoffeeee @behackl @hydrobeam any opinions? |
|
Hi sorry for the delay. I think a good method to customize the matrix would be to let users pass any keyword args as |
|
Superseded by #2138. |
Overview: What does this pull request change?
As mentioned in #1423 this PR adds the option of displaying background rectangle in the
coordinate_labelfunction in theVectorclass. This is done by adding a parameter in the function call.Motivation and Explanation: Why and how do your changes improve the library?
In some discussions and PR #1407 it was mentioned how this small enhancement is required in order to give the user an option to be able to display background rectangle or not.
Links to added or changed documentation pages
Earlier, when Vector.coordinate_label was called, it did not have a parameter for showing background color of the coordinate labels. I have added a parameter to the coordinate_label function which enables user to provide a background color to the coordinates
Old:
New:
Further Information and Comments
This is my first PR in an open source project (outside of Hacktober Fest). Open to suggestions and modifications.
Reviewer Checklist