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

Skip to content

FIX: add base kwarg to symlognor #16404

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 3 commits into from
Feb 16, 2020

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Feb 4, 2020

PR Summary

SymLogNorm has a linear range that the docs stated was the same size as a decade in the logarithmic range. Except the logarithm being used in the code was base=np.e, not base=10, so it was not really a decade.

This PR prepares to change the default to 10 by adding a base kwarg, and warning if it is not specified. If a user wants to suppress the warning they should specify base.

In 3.3. we may change the algorithm again slightly #16391, but will almost certainly default to base=10 rather than np.e.

This was discussed on the Feb 3 Dev call.

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

@jklymak jklymak added this to the v3.2.0 milestone Feb 4, 2020
@jklymak jklymak added topic: color/color & colormaps Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labels Feb 4, 2020
@jklymak jklymak force-pushed the fix-add-base-symlognorm branch 2 times, most recently from 8c1fee8 to fdb00b0 Compare February 4, 2020 14:52
@@ -1213,7 +1213,7 @@ class SymLogNorm(Normalize):
*linthresh* allows the user to specify the size of this range
(-*linthresh*, *linthresh*).
"""
def __init__(self, linthresh, linscale=1.0,
def __init__(self, linthresh, linscale=1.0, base=None,
Copy link
Member

Choose a reason for hiding this comment

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

This needs to go at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done...

Copy link
Member

Choose a reason for hiding this comment

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

Is there a guide on which arguments we may/want to make keyword-only?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but in this case, we can't really make any of then kwarg only because of back-compatibility concerns.

Copy link
Member

Choose a reason for hiding this comment

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

I am talking only about the added one.

Copy link
Member

Choose a reason for hiding this comment

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

As proposed in #16181, I‘d make almost all arguments kw-only. This will in particular also hold for added parameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, are you guys asking that just the new param is kwarg only, or all of them?

Copy link
Member

Choose a reason for hiding this comment

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

For now, only the new parameter base can be kw-only. Making other parameters kw-only needs a deprecation first.

@jklymak jklymak force-pushed the fix-add-base-symlognorm branch from fdb00b0 to e16a257 Compare February 10, 2020 20:45
@jklymak jklymak force-pushed the fix-add-base-symlognorm branch from f6f3963 to fe5fdf8 Compare February 16, 2020 01:02
@Kojoley Kojoley merged commit 3a8e75e into matplotlib:master Feb 16, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Feb 16, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 3a8e75ed151414ac15cbc0e6568f0d09fffdab31
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #16404: FIX: add base kwarg to symlognor'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-16404-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #16404 on branch v3.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull request Feb 16, 2020
FIX: add base kwarg to symlognor

Conflicts:
	doc/api/next_api_changes/behaviour.rst
          - moved to
            doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst and re-worded.
	lib/matplotlib/colors.py
          - implicitly backported converting the docstring to numpy
            doc style.  Re-worded new docstring
jklymak added a commit that referenced this pull request Feb 21, 2020
…-v3.2.x

Merge pull request #16404 from jklymak/fix-add-base-symlognorm
@jklymak jklymak deleted the fix-add-base-symlognorm branch February 26, 2020 03:27
@QuLogic
Copy link
Member

QuLogic commented Apr 25, 2020

The deprecation here is all confusing. It's marked as since 3.3, but 3.3 is when the deprecation is supposed to go away. The deprecation message also never had any version numbers to indicate when things changed or will change. I don't know if changing this after one minor release is best without this information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: color/color & colormaps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants