Skip to content

Plotting Fractals #93

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 34 commits into from
Aug 14, 2021
Merged

Plotting Fractals #93

merged 34 commits into from
Aug 14, 2021

Conversation

MichaelRipa
Copy link
Contributor

Hi NumPy Devs,

As proposed in #92 , this tutorial demonstrates how to plot fractal visuals using NumPy and matplotlib. It also makes use of the mpl_toolkits library (to fix formatting issues with the colorbars). All feedback is welcome, please don't hesitate to request changes of any kind!

Thanks again for your time!

Michael

@numpy numpy deleted a comment from review-notebook-app bot Jul 21, 2021
@rossbar
Copy link
Collaborator

rossbar commented Jul 21, 2021

Thanks for this very nice tutorial @MichaelRipa ! I took the liberty of pushing up a few changes related to the workflow so that we could get the CI running correctly. The two most relevant changes are:

  • I added your new tutorial to the toctree in site/applications.md - this guarantees that the new tutorial will be included in the generated html site.
  • I converted the notebook itself from .ipynb to the text-based notebook format used in this repo. This makes writing and especially reviewing notebooks much more straightforward. Note that if you have jupytext installed (see environments.yml or requirements.txt) the notebook will still open in the browser the way you are used to with an .ipynb file, so this shouldn't impact your workflow at all --- please let us know if you have problems or questions though!

With the CI passing, you can now view the rendered notebook from the build-docs artifact link in the CI checks above. Here's a link to the new tutorial for convenience: https://266-248354526-gh.circle-artifacts.com/0/site/_build/html/content/tutorial-plotting-fractals.html

I've only had a chance to skim the content of the tutorial itself so far, but at first glance it looks excellent! I will aim to take a closer look as soon as I have time.

@mattip
Copy link
Member

mattip commented Jul 21, 2021

I like the progression of the tutorial from basics to beautiful fractals. I think it would be helpful to use links in the body of the tutorial to relevant NumPy, matplotlib documentation and wiki articles.

@MichaelRipa
Copy link
Contributor Author

@rossbar Thanks for taking the time to fix up the submission errors and converting the notebook type, as well as for your feedback! My local copy of the notebook is now paired with MyST and so any future submissions on my end should be consistant with the repository.

@mattip Thanks your feedback, that's a great suggestion! I can start working on implementing this change, I will start by adding links for Universal Functions, meshgrid, 3d scatterplots, Boolean indexing and imshow as they would be the easiest to add in. I also will add wiki links to the prerequisites I mentioned in the "What you'll need" section. Please let me know if there are other things that would be good to link into the tutorial.

MichaelRipa and others added 4 commits July 22, 2021 09:41
Added documentation links for Universal Functions, meshgrid, 3d scatterplots, Boolean indexing and imshow. Also added wiki links for the prerequisite materials.
Copy link
Collaborator

@rossbar rossbar left a comment

Choose a reason for hiding this comment

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

Very nice tutorial @MichaelRipa !

I took a first pass through the code and went ahead and made a few minor changes along with some suggestions. I mostly focused on the code cells rather than the text.

I did notice one high-level terminology issue, though as I mention in the comments, I'm not an expert so maybe my understanding is flawed: I think some of the sets that are referred to in this tutorial as "generalized Mandelbrot sets" or similar are more accurately described as Julia sets. If I'm missing something on this point LMK, otherwise I think it'd be good to tighten up the wording in the Mandelbrot text.

Once these are addressed I'd like to do one last pass as more of a copy-edit, but IMO this is already in great shape. Thanks again!

@MichaelRipa
Copy link
Contributor Author

@rossbar Really appreciate you taking the time to go through the tutorial and provide feedback; your updates are excellent and the comments are a huge help! I will begin going through the updates and comments over the next few days and begin incorporating the suggestions you provided.

Again, a huge thanks for your updates, they really help improve the readability and I have learned a lot from them!

@rossbar
Copy link
Collaborator

rossbar commented Jul 26, 2021

Just a quick note: the failing CI had nothing to do with your tutorial @MichaelRipa. I pushed up a temporary fix in 5d81214 just to keep the review process flowing.

MichaelRipa and others added 4 commits July 26, 2021 12:27
This looks far better, and fixing up ufunc comments should be pretty easy.

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
I like this update, the code looks more compact, and has taught me some new syntax!

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Did not know about the Polynomial package, will do some reading and will briefly touch on it in my next commit.

Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

This is such a cool tutorial, thank you @MichaelRipa !

I left a few very small comments but overall this looks really good. If you can, would you mind running a PEP8 checker on the code when you update the tutorial?

@MichaelRipa
Copy link
Contributor Author

Thank you @melissawm for your review of the tutorial, your feedback and effort is very much appreciated! I am currently not somewhere with a good internet connection, but I will commit the suggestions early next week and should have my update ready shortly after! (which I will run a PEP8 checker on)

@rossbar
Copy link
Collaborator

rossbar commented Aug 6, 2021

which I will run a PEP8 checker on

Just a quick tip: you can use jupytext to run a PEP8 checker, e.g. jupytext tutorial-plotting-fractals.md --check flake8. You may want to suppress the E501 warnings though because you will get a lot errors from the markdown cells where text tends to be longer than 80chars.

An (IMO better) alternative is to use jupytext to apply formatting rules to the whole file automatically, e.g. with black: jupytext tutorial-plotting-fractals.md --pipe black. Instead of only warning about linting errors, this will automatically fix them, though black is far more opinionated than a pure pep8 linter would be.

MichaelRipa and others added 11 commits August 8, 2021 08:49
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Co-authored-by: Melissa Weber Mendonça <melissawm@gmail.com>
Updated an incorrect link.
@MichaelRipa
Copy link
Contributor Author

Thanks again @rossbar and @melissawm for your updates, they really make a difference in the quality of the tutorial! I finished up my updates for now, I believe that I addressed all of the issues brought up earlier but do let me know if I missed anything.

Here is a quick summary of the major changes:

  • I added a very short new section that discusses and plots the Mandelbrot set, as it turned out that I had not plotted it at all in the previous update. I also gave concise definitions for the filled-in Julia set, Julia set and Mandelbrot set, as my previous update considered everything as a "Mandelbrot fractal" which was wrong. This resulted in me renaming certain sections and functions to keep consistant with the update.

  • I ran a PEP8 check and fixed a large majority of the errors. I left a few that I was unsure about:

    • W605 (Shows up from using '\' in the title of certain plots)
    • E703 (Using semi-colons to suppress output)
    • E731 (Using a lambda function instead of def)
    • E7501
  • I briefly mentioned the Polynomial class and linked to its documentation.

  • I added wiki links for the Mandelbrot set, Julia set and for Newton fractals in the "Further reading" section.

Thanks for being patient with this one, it took me longer than expected to finish. As always, don't hesitate to provide any feedback or suggestions to the updates, all of your help has been very much appreciated thus far!

Copy link
Member

@melissawm melissawm left a comment

Choose a reason for hiding this comment

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

I am happy with the tutorial, looks great - thanks again @MichaelRipa for the awesome content!

@rossbar
Copy link
Collaborator

rossbar commented Aug 14, 2021

This LGTM, thanks @MichaelRipa for the idea and hard work & @melissawm for the nice suggestions! Let's put this in and iterate on any improvements/ideas in follow-up PRs.

@rossbar rossbar merged commit 902b05a into numpy:main Aug 14, 2021
@MichaelRipa
Copy link
Contributor Author

I just wanted to thank everyone again for all the help and encouragement. This was my first experience contributing to open source and I couldn't have gotten a better introduction to the open-source community then I did here! Hope to get to work with you all again on future projects, see you in the follow-up PRs!

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.

4 participants