-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Colorbar with SymmetricalLogLocator now handles negative values (Pull request issue for #7202) #7211
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
Conversation
@efiring as requested by @tacaswell |
@@ -2126,6 +2126,8 @@ def get_log_range(lo, hi): | |||
a_range = get_log_range(t, -vmin + 1) | |||
else: | |||
a_range = get_log_range(-vmax, -vmin + 1) | |||
if vmin<0 and vmax<0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tacaswell
get_log_range will return a single decade for values bound by two consecutives 2**x:
for instance, -100<x<-10
hence, i'm artificially adding one decade more bounded to 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but why does this only apply to negative values?
Thanks! It looks like there are a white space style issues, can you please clean those up? |
I took the liberty to rename the title of the PR to something I can understand without browsing the issue. |
@@ -600,12 +600,17 @@ def _ticker(self): | |||
formatter.set_data_interval(*intv) | |||
|
|||
b = np.array(locator()) | |||
if isinstance(locator, ticker.LogLocator): | |||
if isinstance(locator, ticker.LogLocator) or isinstance(locator, ticker.SymmetricalLogLocator): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be simplified to:
if isinstance(locator, (ticker.LogLocator, ticker.SymmetricalLogLocator)):
This issue is related to negative values, hence the patch only applies to negative values. |
Hi @egaudry |
@NelleV |
hi @egaudry |
@NelleV Hi, I haven't a simple test-case to provide, but you could easily reproduce the issue by displaying value between -20 and -90 for instance (all contained in a single negative decade). Thx |
So the bug has nothing to do with the SymmetricalLogLocator? |
@NelleV My understanding is that it has to do with the SymmetricalLogLocator as you wouldn't use another locator to display negative values with a logarithmic scale. |
I'll finish the job. I am halfway there, though I'd appreciate the code to On Oct 23, 2016 11:36 AM, "egaudry" notifications@github.com wrote:
|
@NelleV sorry I cannot help, I haven't a reproducer anymore and no time to write it down. If you do try to display values strictly between 2 negative decades, then you'll be able to reproduce the issue I was referring to. |
Pull request issue for issue #7202.
The attached patch allows to draw ticks/ticklabels in case no decade (or only one) was selected based on vmin/vmax detected values. There is however still an issue in the colorbar height.