Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

egaudry
Copy link

@egaudry egaudry commented Oct 3, 2016

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.

@egaudry
Copy link
Author

egaudry commented Oct 3, 2016

@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:
Copy link
Member

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

Copy link
Author

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.

Copy link
Member

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?

@tacaswell
Copy link
Member

Thanks!

It looks like there are a white space style issues, can you please clean those up?

@tacaswell tacaswell added this to the 2.0.1 (next bug fix release) milestone Oct 3, 2016
@NelleV NelleV changed the title Pull request issue for #7202 Colorbar with SymmetricalLogLocator now handles negative values (Pull request issue for #7202) Oct 3, 2016
@NelleV
Copy link
Member

NelleV commented Oct 3, 2016

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):
Copy link
Member

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)):

@egaudry
Copy link
Author

egaudry commented Oct 4, 2016

This issue is related to negative values, hence the patch only applies to negative values.
If you have a generic approach, more robust, please feel free to add your patch instead :)

@NelleV
Copy link
Member

NelleV commented Oct 23, 2016

Hi @egaudry
Do you plan on finishing up this PR? It needs a test, and as @tacaswell mentioned, though your patch does fix the problem it may not be the best or cleanest fix.

@egaudry
Copy link
Author

egaudry commented Oct 23, 2016

@NelleV
hi Nelle, sorry, I cannot commit on this. Hence, closing the Pull request. Thanks

@egaudry egaudry closed this Oct 23, 2016
@NelleV
Copy link
Member

NelleV commented Oct 24, 2016

hi @egaudry
I'll finish up the work. I may have a fix, but can't seem to test your use case… Do you mind sending me a small script to test?
Cheers,
N

@egaudry
Copy link
Author

egaudry commented Oct 24, 2016

@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

@NelleV
Copy link
Member

NelleV commented Oct 24, 2016

So the bug has nothing to do with the SymmetricalLogLocator?

@egaudry
Copy link
Author

egaudry commented Oct 24, 2016

@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.

@NelleV
Copy link
Member

NelleV commented Oct 25, 2016

I'll finish the job. I am halfway there, though I'd appreciate the code to
reproduce your exact problem.
I found a bug but I am now wondering if there is not another one.

On Oct 23, 2016 11:36 AM, "egaudry" notifications@github.com wrote:

@NelleV https://github.com/NelleV
hi Nelle, sorry, I cannot commit on this. Hence, closing the Pull request.
Thanks


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7211 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALR3h7bEXtm9dI69F1dPA_5UzFo7RrJks5q238bgaJpZM4KMkVq
.

@egaudry
Copy link
Author

egaudry commented Oct 26, 2016

@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.

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Dec 7, 2016
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.

6 participants