Skip to content

modernize matplotlib sections of interact notebook #188

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 6 commits into from
Jul 7, 2022
Merged

modernize matplotlib sections of interact notebook #188

merged 6 commits into from
Jul 7, 2022

Conversation

ianhi
Copy link
Contributor

@ianhi ianhi commented Jul 6, 2022

Got a little bit longer - could definitely cut stuff out, but felt important to include the original section in order to contrast as otherwise it leaves you with the question of "well why not just do that?".

Could also consider moving mpl-interactions to the "other widget libraries" section

closes: #173

attn: @bsyouness

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Binder 👈 Launch a binder notebook on branch jupyter-widgets/tutorial/ipympl

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Binder 👈 Launch a binder notebook on branch jupyter-widgets/tutorial/ipympl

2 similar comments
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Binder 👈 Launch a binder notebook on branch jupyter-widgets/tutorial/ipympl

@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Binder 👈 Launch a binder notebook on branch jupyter-widgets/tutorial/ipympl

@marimeireles
Copy link
Member

🎉❤️
The conflict comes from my PR, I guess.
Lemme know if you want me to fix it =)

@@ -25,7 +25,9 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't follow where the note is pointing -- there is no interactive_plot variable in the cell below,


Reply via ReviewNB

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, ReviewNB put all of the comments in the wrong place 🙄

Copy link
Contributor

Choose a reason for hiding this comment

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

I updated the text.

@@ -25,7 +25,9 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the line magic need to be used before every interactive plot or just once somewhere in the notebook?


Reply via ReviewNB

Copy link
Contributor

@bsyouness bsyouness Jul 6, 2022

Choose a reason for hiding this comment

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

Same as %matplotlib widget (which should also work actually), it just has to be included before the plots you're making as per the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the line magic need to be used before every interactive plot or just once somewhere in the notebook?

Good question, just once per notebook

Same as %matplotlib widget (which should also work actually),

widget and ipympl are direct aliases. I've been using ipympl everywhere because it think it's more googleable for someone who comes across it. But I think that's mostly personal preference.

@@ -276,7 +276,7 @@
"source": [
Copy link
Contributor

Choose a reason for hiding this comment

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

fig.canvas should have backticks around it.

Also, boundbind


Reply via ReviewNB

Copy link
Contributor

@mwcraig mwcraig left a comment

Choose a reason for hiding this comment

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

Just a few minor changes, plus to conflict resolution. Looks good, and I'm glad to see us doing it the correct way now!

@@ -25,7 +25,9 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, ReviewNB put all of the comments in the wrong place 🙄

"The function below plots a straight line whose slope and intercept are given by its arguments."
"The function below plots a straight line whose slope and intercept are given by its arguments.\n",
"\n",
"The interactive below displays a line whose slope and intercept is set by the sliders. Note that if the variable containing the widget, `interactive_plot`, is the last thing in the cell it is displayed."
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a variable called interactive_plot

"\n",
"Here is a python function that, given $k$ and $p$, plots $f(x) = \\sin(k x - p)$.\n"
"A better solution is to use the [ipympl](https://matplotlib.org/ipympl/) Matplotlib backend. You can activate this with the line magic: `%matplotlib ipympl`. Then in your interactive function you update the matplotlib artists."
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the line magic need to be used before each plot or just once in the notebook?

@bsyouness bsyouness changed the title moderize matplotlib sections of interact notebook modernize matplotlib sections of interact notebook Jul 6, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

Binder 👈 Launch a binder notebook on branch jupyter-widgets/tutorial/ipympl

environment.yml Outdated
@@ -28,3 +28,4 @@ dependencies:
- voila-vuetify=0.5.2
- voila-material=0.4.0
- vtk=8.2.0
- mpl_interactions
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to specify a version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. I will update with the most recently released version 0.22.0

Copy link
Contributor

@bsyouness bsyouness left a comment

Choose a reason for hiding this comment

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

Thanks for updating this!! I reviewed the interact notebook and made some small edits. Updated the environment.yml file to add mpl_interactions. I didn't review the "More Libraries" section.

@mwcraig
Copy link
Contributor

mwcraig commented Jul 7, 2022

Thanks, merging! We'll finalize dependencies at the meeting later today.

@mwcraig mwcraig merged commit 25a33d2 into main Jul 7, 2022
@bsyouness bsyouness deleted the ipympl branch July 7, 2022 14:55
ibdafna added a commit that referenced this pull request Jul 9, 2022
Signed-off-by: Itay Dafna <i.b.dafna@gmail.com>
mwcraig added a commit that referenced this pull request Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix interactive plot examples in notebook 02.00
4 participants