Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify _process_plot_var_args. #14641

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 1 commit into from
Jul 16, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 27, 2019

  • The unit handling at the top of __call__ is duplicated with
    Axes._process_unit_info, so just use that.
  • The conditional call to convert_xunits in _xy_from_xy can
    be moved to _makefill (the only case where it's needed), and made
    non-conditional (if x is not unitized, convert_xunits will just
    return it as is).
  • The rest of _xy_from_xy can be inlined into its only call site
    (_plot_args) which also makes clear that the calls to _check_1d
    are redundant because the caller already calls _check_1d (possibly
    via index_of) immediately before.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

- The unit handling at the top of `__call__` is duplicated with
  `Axes._process_unit_info`, so just use that.
- The conditional call to `convert_xunits` in `_xy_from_xy` can
  be moved to `_makefill` (the only case where it's needed), and made
  non-conditional (if `x` is not unitized, `convert_xunits` will just
  return it as is).
- The rest of `_xy_from_xy` can be inlined into its only call site
  (`_plot_args`) which also makes clear that the calls to `_check_1d`
  are redundant because the caller already calls `_check_1d` (possibly
  via `index_of`) immediately before.
@anntzer anntzer force-pushed the process_plot_var_args branch from b3fe08d to 4da5bc1 Compare June 27, 2019 12:12
@jklymak jklymak merged commit e7841c2 into matplotlib:master Jul 16, 2019
@jklymak jklymak added this to the v3.2.0 milestone Jul 16, 2019
@anntzer anntzer deleted the process_plot_var_args branch July 16, 2019 19:23
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.

3 participants