| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
... there is a workaround, so perhaps not release critical. |
Sorry, something went wrong.
| if (isinstance(self.mappable, contour.ContourSet) and | ||
| isinstance(self.norm, colors.LogNorm)): |
There was a problem hiding this comment.
It seems odd that this special casing has to be done, what's stopping the more generic code path on L1228 being hit below? (perhaps LogNorm doesn't have a _scale attribute set?)
Sorry, something went wrong.
There was a problem hiding this comment.
The contours have boundaries so we get caught in the first case which just uses a linear scale.
Sorry, something went wrong.
There was a problem hiding this comment.
Should that first case be modified to get the scale from self.norm._scale (if present) instead then?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, thanks, I think you are right. Lets see if this passes the other tests...
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, this works, and I think is more consistent with what users would want for other boundary norm cases. Thanks!
Sorry, something went wrong.
There was a problem hiding this comment.
This now seems like you are special-casing LogNorms only for contoursets.
I think the main issue is that there are some self.boundaries, but the norm is changed so we don't want to take that path, so perhaps we could add a check on the norm below.
(self.boundaries is not None and type(self.norm) is colors.Normalize)What I'm worried about is that we are whacking the LogLocator() with this change, but we also want to be able to handle any other special-cased locators too without adding additional if clauses above.
Sorry, something went wrong.
There was a problem hiding this comment.
It may be valid, but I'm not following your concern here. This is usually only called at init, or if the norm is changed, both of which are pretty destructive to the colorbar. Everything gets whacked, as noted in the docstring.
Sorry, something went wrong.
There was a problem hiding this comment.
My concern is mostly that this handles: locator=ticker.LogLocator(), and will this mean that we'll also need to special case SymmetricalLogLocator() in the future.
But, looking at the contour code it looks like only log-scales are special cased, and they set an explicit logscaled attribute. So, should we actually be using that here instead?
if getattr(self.mappable, "logscale", False):
Sorry, something went wrong.
|
This doesn't now seem to fix the original issue? I don't see minor ticks with ec8ae4b as you do with cbar.ax.set_yscale('log'). |
Sorry, something went wrong.
|
the original issue was that the formatter was the normal formatter, not the scientific formatter. The other thing that changed is that before colorbar had its own ticking and handled log ticking differently than normal axes. Now the ticker is the same as for any other axes, and for this dynamic range there are no minor ticks drawn. I think making the colorbar consistent with other axes should trump the small breakage here, rather than trying to have a special mechanism to tick colorbars differently. |
Sorry, something went wrong.
| plt.colorbar(c, ax=ax) | ||
|
|
||
|
|
||
| @image_comparison(['contour_log_locator.png'], style='mpl20', remove_text=True) |
There was a problem hiding this comment.
Maybe do this as an svg test and keep the text? The issue is the labels are wrong not the tick locations.
Sorry, something went wrong.
|
Calling cbar = fig.colorbar(cs, spacing='proportional') on the last commit also get the log-formatted tick labels. |
Sorry, something went wrong.
|
Ooops, yes, I see. I thought proportional was the default, but its actually uniform... This is pretty clearly a case where we have gone overboard in the API having a lot of edge cases. I'll try to give it some thought to how to fix, and indeed maybe going back to the previous fix... |
Sorry, something went wrong.
|
OK, reverted back to the case that was working before with the hard-coded check. Also updated test to use svg with text. |
Sorry, something went wrong.
|
Hard cycled to get a retry on circle CI |
Sorry, something went wrong.
There was a problem hiding this comment.
This does fix the example, so approving as an improvement for now. If someone hits some other edge cases it can be fixed in a follow-up PR.
Sorry, something went wrong.
| if (isinstance(self.mappable, contour.ContourSet) and | ||
| isinstance(self.norm, colors.LogNorm)): |
There was a problem hiding this comment.
My concern is mostly that this handles: locator=ticker.LogLocator(), and will this mean that we'll also need to special case SymmetricalLogLocator() in the future.
But, looking at the contour code it looks like only log-scales are special cased, and they set an explicit logscaled attribute. So, should we actually be using that here instead?
if getattr(self.mappable, "logscale", False):
Sorry, something went wrong.
|
I think the Circle CI failure may be fixed if you rebase this on upstream/main to bring it up to date with main because the failures look unrelated to this PR. |
Sorry, something went wrong.
|
I don't know that this needs to be back ported to 3.6, but it would be nice to get in for 3.7 |
Sorry, something went wrong.
|
It seems to have two approvals, so... |
Sorry, something went wrong.
…uld default to log locator and formatter...
…uld default to log locator and formatter...
…390-on-v3.7.x Backport PR #23390 on branch v3.7.x (FIX: colorbar contour with log norm should default to log locator and formatter...)
…390-on-v3.6.x Backport PR #23390 on branch v3.6.x (FIX: colorbar contour with log norm should default to log locator and formatter...)
|
Hello, is this issue really fixed? |
Sorry, something went wrong.
|
@jmorenoven2 Please open a new issue with a reproducible example of the problem you are having. Calling fig.colorbar more than once is expected to create multiple colorbars and without context it is very hard to understand what setting the scale on colorbar yaxis should be doing. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
This sets the colorbar to have a log scale if the norm on contours is log. This wasn't previously tested, but did break an example. Without this fix, the contours get a linear ticker at the contour boundaries.
closes #23389
PR Checklist
Tests and Styling
Documentation