Skip to content

[MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 #6762

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 37 commits into from
May 10, 2016

Conversation

ztultrebor
Copy link
Contributor

@ztultrebor ztultrebor commented May 4, 2016

#6754

Reference Issue

What does this implement/fix? Explain your changes.

  • multiple instances of occurrences of pylab replaced with matplotlib.pyplot
  • references to pl ( as in import pylab as pl) replaced
    with plt (as in import matplotlib.pyplot as plt)

Any other comments?

  • one file still contains references to pylab: doc/sphinxext/gen_rst.py
  • I'd need some time to figure out what needs to be done; closing this for now

 - one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
 - bench_glm.py now free of pylab references
 - code executes properly
@agramfort
Copy link
Member

there is only one file changed in this PR so far

ztultrebor added 8 commits May 5, 2016 19:41
- one instance of 21 remaining occurrences of pylab replaced with
    matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
    glmnet.elastic_net
- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly
- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly
- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
    - File "bench_plot_omp_lars.py", line 111, in <module>
    - ax = fig.add_subplot(1, 2, i)
    - ValueError: num must be 1 <= num <= 2, not 0
    - line 111 should probably be ax = fig.add_subplot(1, 2, i+1)
- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly
- bench_plot_ward.py now free of pylab references
- code executes properly
- bench_sgd_regression.py now free of pylab references
- code executes properly
- bench_tree.py now free of pylab references
- code executes properly
@@ -12,7 +12,7 @@

if __name__ == '__main__':

import pylab as pl
import matplotlib.pyplot as pl
Copy link
Member

Choose a reason for hiding this comment

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

standard import name is plt

please change all occurrences.

thanks

ztultrebor added 14 commits May 8, 2016 18:46
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly
- replaced with matplotlib.pyplot
- pl --> plt
- replaced with matplotlib.pyplot
- pl --> plt
- replaced with matplotlib.pyplot
- pl --> plt
@@ -212,15 +212,15 @@ induces high variance:
>>> test = np.c_[ 0, 2].T
>>> regr = linear_model.LinearRegression()

>>> import pylab as pl # doctest: +SKIP
>>> pl.figure() # doctest: +SKIP
>>> import matplotlib as plt # doctest: +SKIP
Copy link
Member

Choose a reason for hiding this comment

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

typo: matplotlib.pyplot

@ogrisel
Copy link
Member

ogrisel commented May 9, 2016

Thanks @ztultrebor. Are you done with this PR? If so please change the title from [WIP] to [MRG].

+1 for merge on my side once #6762 (comment) is taken care of.

@ztultrebor
Copy link
Contributor Author

I've still got a few more files to clean up. Once those are taken care of I'll be certain to update the pull title appropriately

ztultrebor added 2 commits May 9, 2016 10:54
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessRegressor
  - ImportError: cannot import name GaussianProcessRegressor
ztultrebor added 6 commits May 9, 2016 11:04
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessClassifier
  - ImportError: cannot import name GaussianProcessClassifier
- replaced with matplotlib.pyplot
- pl --> plt
- replaced with matplotlib.pyplot
- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly
- replaced with matplotlib.pyplot
- replaced with matplotlib.pyplot
@ztultrebor ztultrebor changed the title [WIP] Fix: Replace pylab with matplotlib.pyplot #6754 [MRG] Fix: Replace pylab with matplotlib.pyplot #6754 May 9, 2016
@@ -131,21 +131,21 @@ def barplot_neighbors(Nrange=2 ** np.arange(1, 11),
xvals = 0.1 + i * (1 + len(vals)) + np.arange(len(vals))
width = 0.8

c_bar = pl.bar(xvals, build_time[alg] - bottom,
c_bar = plt.bar(xvals, build_time[alg] - bottom,
width, bottom, color='r')
Copy link
Member

Choose a reason for hiding this comment

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

you need to change the indentation here and there, since you added a character

@ogrisel ogrisel changed the title [MRG] Fix: Replace pylab with matplotlib.pyplot #6754 [MRG+1] Fix: Replace pylab with matplotlib.pyplot #6754 May 10, 2016
@TomDLT TomDLT merged commit 0c879ba into scikit-learn:master May 10, 2016
@TomDLT
Copy link
Member

TomDLT commented May 10, 2016

Thank you @ztultrebor !

olologin pushed a commit to olologin/scikit-learn that referenced this pull request Aug 24, 2016
…cikit-learn#6762)

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

 - one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
 - bench_glm.py now free of pylab references
 - code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 21 remaining occurrences of pylab replaced with
    matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
    glmnet.elastic_net

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
    - File "bench_plot_omp_lars.py", line 111, in <module>
    - ax = fig.add_subplot(1, 2, i)
    - ValueError: num must be 1 <= num <= 2, not 0
    - line 111 should probably be ax = fig.add_subplot(1, 2, i+1)

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_plot_ward.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_sgd_regression.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_tree.py now free of pylab references
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons

* fix: Fix bug that prevented graphs from displaying

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly

* docs: removed pylab references from comments

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed pylab references from comments

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessRegressor
  - ImportError: cannot import name GaussianProcessRegressor

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessClassifier
  - ImportError: cannot import name GaussianProcessClassifier

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* style: Indent properly

* style: indent properly

* style: Indent properly

* docs: Add missing .pyplot

* docs: Fix typo

* style: Indent properly
TomDLT pushed a commit to TomDLT/scikit-learn that referenced this pull request Oct 3, 2016
…cikit-learn#6762)

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

 - one instance of 22 occurrences of pylab replaced with matplotlib.pyplot
 - bench_glm.py now free of pylab references
 - code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 21 remaining occurrences of pylab replaced with
    matplotlib.pyplot
- bench_glmnet.py now free of pylab references
- code does not execute for extraneous reason: ImportError: No module named
    glmnet.elastic_net

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 19 occurrences of pylab replaced with matplotlib.pyplot
- bench_lasso.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 18 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_neighbors.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- one instance of 17 occurrences of pylab replaced with matplotlib.pyplot
- bench_plot_omp_lars.py now free of pylab references
- code does not execute for extraneous reasons:
    - File "bench_plot_omp_lars.py", line 111, in <module>
    - ax = fig.add_subplot(1, 2, i)
    - ValueError: num must be 1 <= num <= 2, not 0
    - line 111 should probably be ax = fig.add_subplot(1, 2, i+1)

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_plot_parallel_pairwise.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_plot_ward.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_sgd_regression.py now free of pylab references
- code executes properly

* Fix: Replace pylab with matplotlib.pyplot scikit-learn#6754

- bench_tree.py now free of pylab references
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_glm.py clean of pl
- code does not execute for extraneous reasons

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_lasso.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_neighbors.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_omp_lars.py clean of pl
- code does not execute for extraneous reasons

* fix: Fix bug that prevented graphs from displaying

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_parallel_pairwise.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_plot_ward.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_sgd_regression.py clean of pl
- code executes properly

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- bench_tree.py clean of pl
- code executes properly

* docs: removed pylab references from comments

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed pylab references from comments

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- mlcomp_sparse_document_classification.py clean of pl

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpr_noisy_targets.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpr_noisy_targets.py", line 31, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessRegressor
  - ImportError: cannot import name GaussianProcessRegressor

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_gpc_isoprobability.py clean of pl
- code does not execute for extraneous reasons
  - File "examples/gaussian_process/plot_gpc_isoprobability.py", line 24, in
      <module>
  - from sklearn.gaussian_process import GaussianProcessClassifier
  - ImportError: cannot import name GaussianProcessClassifier

* docs: removed all pylab references

- replaced with matplotlib.pyplot
- pl --> plt

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* refactor: Replace pl with plt

- replace instances of pl (as on import pylab as pl)
  with plt (as in import matplotlib.pyplot as plt)
- plot_sparse_coding.py clean of pl
- code executes properly

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* docs: removed all pylab references

- replaced with matplotlib.pyplot

* style: Indent properly

* style: indent properly

* style: Indent properly

* docs: Add missing .pyplot

* docs: Fix typo

* style: Indent properly
trevorstephens added a commit to trevorstephens/scikit-learn that referenced this pull request Jul 26, 2017
trevorstephens added a commit to trevorstephens/scikit-learn that referenced this pull request Aug 12, 2017
trevorstephens added a commit to trevorstephens/scikit-learn that referenced this pull request May 25, 2018
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