kangwonlee / kangwonlee/nmisp

Maintenance: migrate pylab → matplotlib.pyplot + numpy across notebooks (33 files)

Open
#390 0 comments 0 reactions 0 assignees View on GitHub
maintenance
Dominant language
Jupyter Notebook
Stars
12
Forks
76
PR merge metrics
No merged PRs in 30d

Description

`pylab` was deprecated in matplotlib 2.x and is discouraged because `from pylab import *` pollutes the namespace — names like `array`, `plot`, `linspace` appear without indicating whether they came from `numpy` or `matplotlib.pyplot`.

## Migration target

Replace `pylab` imports with explicit:

```python
import numpy as np
import matplotlib.pyplot as plt
```

Then qualify bare names: `array(...)` → `np.array(...)`, `plot(...)` → `plt.plot(...)`, `linspace(...)` → `np.linspace(...)`, etc.

## Per-notebook checklist

### 00_introduction (1)
- [ ] `00_introduction/00_introduction.ipynb`

### 10_root_finding (6)
- [ ] `10_root_finding/10_sequential.ipynb`
- [ ] `10_root_finding/20_bisection.ipynb`
- [ ] `10_root_finding/30_newton_raphson.ipynb`
- [ ] `10_root_finding/40_examples.ipynb`
- [ ] `10_root_finding/42_examples_beams.ipynb`
- [ ] `10_root_finding/45_newton_raphson_complex.ipynb`

### 20_probability (2)
- [ ] `20_probability/15_random_variables.ipynb`
- [ ] `20_probability/20_statistics.ipynb`

### 28_interpolation (1)
- [ ] `28_interpolation/00_interpolation.ipynb`

### 30_num_int (6)
- [ ] `30_num_int/00_zeroth_order.ipynb`
- [ ] `30_num_int/10_first_order.ipynb`
- [ ] `30_num_int/20_second_order.ipynb`
- [ ] `30_num_int/25_convergence_order.ipynb`
- [ ] `30_num_int/30_T_section_centroid.ipynb`
- [ ] `30_num_int/40_circular_section_MOI.ipynb`

### 35_sympy (1)
- [ ] `35_sympy/20_Beam_Reaction_Force_General.ipynb`

### 40_linear_algebra_1 (6)
- [ ] `40_linear_algebra_1/10_vector_addition_subtraction.ipynb`
- [ ] `40_linear_algebra_1/15_vector_addition_subtraction_numpy.ipynb`
- [ ] `40_linear_algebra_1/20_vector_dot_cross_product.ipynb`
- [ ] `40_linear_algebra_1/30_3D_line_plane.ipynb`
- [ ] `40_linear_algebra_1/37_Gram_Schmidt.ipynb`
- [ ] `40_linear_algebra_1/40_matrix_and_vector.ipynb`

### 50_ode (6)
- [ ] `50_ode/10_Forward_Euler.ipynb`
- [ ] `50_ode/15_Forward_Euler_Higher_Order.ipynb`
- [ ] `50_ode/20_Heun_Method.ipynb`
- [ ] `50_ode/30_Runge_Kutta.ipynb`
- [ ] `50_ode/35_Runge_Kutta_Higher_Order.ipynb`
- [ ] `50_ode/45_Example_Cantilever.ipynb`

### 60_linear_algebra_2 (3)
- [ ] `60_linear_algebra_2/120_System_Linear_Eq_Four_Node_Truss.ipynb`
- [ ] `60_linear_algebra_2/125_System_Linear_Eq_Five_Node_Truss.ipynb`
- [ ] `60_linear_algebra_2/220_Google_PageRank.ipynb`

## Per-notebook acceptance

- No `pylab` references remain (`grep -L pylab` clean).
- Imports use `import numpy as np` and `import matplotlib.pyplot as plt`.
- Notebook executes top-to-bottom (`jupyter nbconvert --execute`).
- Output figures still render correctly (visual sanity check before/after).

## Workflow

- Push only to `origin/main` per repo convention (Colab badge URLs encode the branch name and don't round-trip from feature branches).
- Commit one folder at a time so the CI Clean-ipynb auto-commit stays scoped.
- 33 notebooks is large; expect to do this incrementally over several sessions.

Will be partly mooted by #388 once local pre-commit cleaning lands, but the pylab → pyplot/numpy migration is independent and worth doing on its own.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.