html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/pull/655#issuecomment-156864017,https://api.github.com/repos/pydata/xarray/issues/655,156864017,MDEyOklzc3VlQ29tbWVudDE1Njg2NDAxNw==,1217238,2015-11-15T22:20:04Z,2015-11-15T22:20:04Z,MEMBER,"Thanks @fmaussion! ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156861015,https://api.github.com/repos/pydata/xarray/issues/655,156861015,MDEyOklzc3VlQ29tbWVudDE1Njg2MTAxNQ==,1217238,2015-11-15T22:07:02Z,2015-11-15T22:07:02Z,MEMBER,"OK, this looks good to me. I'm just waiting on @mwaskom before merging. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156798769,https://api.github.com/repos/pydata/xarray/issues/655,156798769,MDEyOklzc3VlQ29tbWVudDE1Njc5ODc2OQ==,10050469,2015-11-15T10:11:30Z,2015-11-15T10:11:30Z,MEMBER,"Right, I forgot to fetch from upstream, now it should be all clean. This PR was a good experience for me! I started using xray a few weeks ago for teaching and it's really awesome to see how students with no prior experience with python are able to get the logic of working with reanalysis data so quickly... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156758224,https://api.github.com/repos/pydata/xarray/issues/655,156758224,MDEyOklzc3VlQ29tbWVudDE1Njc1ODIyNA==,1217238,2015-11-14T23:36:18Z,2015-11-14T23:36:18Z,MEMBER,"@fmaussion try pulling the latest master and rebasing this branch? If that doesn't work for you, I can apply this change manually. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156743832,https://api.github.com/repos/pydata/xarray/issues/655,156743832,MDEyOklzc3VlQ29tbWVudDE1Njc0MzgzMg==,10050469,2015-11-14T20:23:42Z,2015-11-14T20:27:40Z,MEMBER,"Ups. I did a ""fixup"" which seems to have broken github. I'm sorry for the mess... What should I do now? I tried it locally and my branch (which consists one one single commit now) can be fast-merged... ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156611108,https://api.github.com/repos/pydata/xarray/issues/655,156611108,MDEyOklzc3VlQ29tbWVudDE1NjYxMTEwOA==,1217238,2015-11-14T02:25:02Z,2015-11-14T02:25:02Z,MEMBER,"This looks good to be -- the tests seem to nail this down pretty well, even though the logic has indeed become more convoluted. @mwaskom any concerns from your side? Please do do a rebase/squash (most importantly to eliminate any commits that failed CI) and also please add a shirt change note to a ""breaking changes"" section of the what's new docs. This will probably not make it in until the 0.7 release (which probably _will_ be our next release), but just go ahead and put it in the 0.6.2 notes for now and we'll reorganize later. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156404409,https://api.github.com/repos/pydata/xarray/issues/655,156404409,MDEyOklzc3VlQ29tbWVudDE1NjQwNDQwOQ==,10050469,2015-11-13T11:37:28Z,2015-11-13T11:37:28Z,MEMBER,"I've incorporated both comments and added the documentation. Let me know if it still needs revision. Should I do a rebase? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156036272,https://api.github.com/repos/pydata/xarray/issues/655,156036272,MDEyOklzc3VlQ29tbWVudDE1NjAzNjI3Mg==,10050469,2015-11-12T08:51:09Z,2015-11-12T08:51:09Z,MEMBER,"I forgot to mention: I tried to reach a compromise between @jhamman and @shoyer in the following: ``` python # Setting non-centered vmin, vmax prevents a divergent cmap if (vmin is not None) and (vmax is not None): if not np.isclose(vmax - center, center - vmin): divergent = False ``` I don't know if `np.isclose()` is good enough for the numerical issues @shoyer mentioned. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-156035236,https://api.github.com/repos/pydata/xarray/issues/655,156035236,MDEyOklzc3VlQ29tbWVudDE1NjAzNTIzNg==,10050469,2015-11-12T08:45:22Z,2015-11-12T08:45:22Z,MEMBER,"Hi @jhamman, > 1. If you set anything, it should not be overwritten. This includes the colormap and vmin/vmax. > 2. If you want very specific/consistent behavior, you'll need to explicitly provide those arguments. This is the actual purpose of my PR. > The only safe times to assume a diverging colormap is when vmin = -vmax or when center is not None. If you want a diverging colormap for other situations, you need to specify cmap in the plot call. I tend to agree with that but this would break backwards compatibility. Previous behavior was to decide that if `vmin < 0`, we have a diverging cmap. This logic remains in my PR, but I can change it if you gurus decide otherwise. Some of the specs added a bit of boilerplate code, especially that one: > if only one of vmin/max is provided and the colormap is diverging, then the other should be determined by reflecting the limit around the center but my changes remain quite small and seem to have preserved backwards compatibility. I tried to cover all the use cases in my test function (`test_divergentcontrol`). Critics and/or additional use cases welcome. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155918906,https://api.github.com/repos/pydata/xarray/issues/655,155918906,MDEyOklzc3VlQ29tbWVudDE1NTkxODkwNg==,1217238,2015-11-11T21:43:03Z,2015-11-11T21:43:03Z,MEMBER,"> 1. The only safe times to assume a diverging colormap is when vmin = -vmax or when center is not None. If you want a diverging colormap for other situations, you need to specify cmap in the plot call. I actually agree with @mwaskom here. I would not make inferring a diverging colormap dependent on `vmin = -vmax` (assuming `center=0`). It's useful to be able to control the bounds of a diverging colormap by only setting one of `vmin` and `vmax`, and comparing `vmin - center == center - vmax` seems prone to numerical precision issues. I do agree with principles 1 and 2, though. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155882953,https://api.github.com/repos/pydata/xarray/issues/655,155882953,MDEyOklzc3VlQ29tbWVudDE1NTg4Mjk1Mw==,2443309,2015-11-11T19:16:20Z,2015-11-11T19:16:20Z,MEMBER,"I'll just chime in here quickly and layout how I think this should go - 1. If you set **anything**, it should not be overwritten. This includes the `colormap` and `vmin`/`vmax`. 2. If you want very specific/consistent behavior, you'll need to explicitly provide those arguments. 3. The only safe times to assume a diverging colormap is when `vmin = -vmax` or when `center is not None`. If you want a diverging colormap for other situations, you need to specify `cmap` in the plot call. All in all, I think what I'm getting at is we may want to tighten up on when we switch from the default `cmap` to the diverging `cmap`. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155834854,https://api.github.com/repos/pydata/xarray/issues/655,155834854,MDEyOklzc3VlQ29tbWVudDE1NTgzNDg1NA==,10050469,2015-11-11T16:26:13Z,2015-11-11T16:26:13Z,MEMBER,"OK, my last push will probably brake some tests. You can have a look at my code and test-cases to see if you agree with the behaviour. I have to go home now, but I can work on this again tomorrow morning (CET) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155831140,https://api.github.com/repos/pydata/xarray/issues/655,155831140,MDEyOklzc3VlQ29tbWVudDE1NTgzMTE0MA==,10050469,2015-11-11T16:14:39Z,2015-11-11T16:14:39Z,MEMBER,"Including this last change (if both vmin and vmax are provided, the logic is that of a non-divergent cmap) brakes several tests. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155827290,https://api.github.com/repos/pydata/xarray/issues/655,155827290,MDEyOklzc3VlQ29tbWVudDE1NTgyNzI5MA==,10050469,2015-11-11T16:03:57Z,2015-11-11T16:03:57Z,MEMBER,"Ok, I have come up with something not too complicated. But before I push the changes, do we agree that when both `vmin` and `vmax` are provided, the logic is that of a non-divergent cmap? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155820563,https://api.github.com/repos/pydata/xarray/issues/655,155820563,MDEyOklzc3VlQ29tbWVudDE1NTgyMDU2Mw==,10050469,2015-11-11T15:40:34Z,2015-11-11T15:41:16Z,MEMBER,"OK, so the test case would look like: ``` python data = np.linspace(0, 1, num=100) - 0.1 cmap_params = _determine_cmap_params(data, vmin=-0.1) self.assertEqual(cmap_params['vmin'], -0.1) self.assertEqual(cmap_params['vmax'], 0.1) self.assertEqual(cmap_params['cmap'], ""RdBu_r"") ``` This of course requires a bit more logic than the simple cases I handled in the first PR. I'll do my best. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205 https://github.com/pydata/xarray/pull/655#issuecomment-155817937,https://api.github.com/repos/pydata/xarray/issues/655,155817937,MDEyOklzc3VlQ29tbWVudDE1NTgxNzkzNw==,10050469,2015-11-11T15:32:29Z,2015-11-11T15:32:29Z,MEMBER,"@mwaskom correct. I forgot to read @shoyer 's comments about this. He said: > If only one of vmin/max is provided and the colormap is diverging, then the other should be determined by reflecting the limit around the center -- not by taking the largest distance from the center. If this results in data falling beyond the color limits, then so be it (in xray, this will be displayed with the extend argument on the colorbar). For example, suppose my data contains values between -10 and 100. If I plot it with vmin=-10 and vmax=None, then (1) we should detect diverging data with center=0 (unless center=False) and (2) we should infer vmax=10. I agree with this, but only if `center` is explicitly provided. I'll try to implement this. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,116349205