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/issues/642#issuecomment-155803491,https://api.github.com/repos/pydata/xarray/issues/642,155803491,MDEyOklzc3VlQ29tbWVudDE1NTgwMzQ5MQ==,10050469,2015-11-11T14:53:00Z,2015-11-11T14:53:00Z,MEMBER,"Here it is: https://github.com/xray/xray/pull/655 ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-155359439,https://api.github.com/repos/pydata/xarray/issues/642,155359439,MDEyOklzc3VlQ29tbWVudDE1NTM1OTQzOQ==,10050469,2015-11-10T08:44:42Z,2015-11-10T08:44:42Z,MEMBER,"Hi Stephan, sure. I'll try to put something together in the next couple of days. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-155293871,https://api.github.com/repos/pydata/xarray/issues/642,155293871,MDEyOklzc3VlQ29tbWVudDE1NTI5Mzg3MQ==,1217238,2015-11-10T05:13:36Z,2015-11-10T05:13:36Z,MEMBER,"@fmaussion any interest in putting together a pull request for seaborn or xray with some of these fixes? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154923759,https://api.github.com/repos/pydata/xarray/issues/642,154923759,MDEyOklzc3VlQ29tbWVudDE1NDkyMzc1OQ==,315810,2015-11-09T04:54:10Z,2015-11-09T04:54:10Z,NONE,"(Also it would be nice if colormaps had some metadata indicating whether they are sequential, diverging, or qualitative, but that's really a matplotlib issue). ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154923196,https://api.github.com/repos/pydata/xarray/issues/642,154923196,MDEyOklzc3VlQ29tbWVudDE1NDkyMzE5Ng==,1217238,2015-11-09T04:53:23Z,2015-11-09T04:53:23Z,MEMBER,"> My point is, there should be a way to use vmin, vmax, and center together and have them all do what they are expected to. Ahh. Yes, that's a good point. Totally agreed. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154915320,https://api.github.com/repos/pydata/xarray/issues/642,154915320,MDEyOklzc3VlQ29tbWVudDE1NDkxNTMyMA==,1217238,2015-11-09T04:16:20Z,2015-11-09T04:52:11Z,MEMBER,"@mwaskom > `center=False` seems like it will collide with `center=0` in surprising ways, but I agree that avoiding an additional kwarg would be ideal. We already distinguish between `center=None` and `center=0` inside the logic for color limits, so I don't think this would be too much worse. I think it is still important to allow disabling automatic divergent plots, even without any specific settings of `vmin` and `vmax`. For example, suppose I want to visualize a bunch of variables in a loop. We already have an easy solution if I want all divergent plots (explicitly set `center=0`), but we don't have any easy way to signal that every plot should be sequential. Suppose I do want all sequential plots, but I'm happy to let the limits be different for each one (I'll add a colorbar). This scenario is actually pretty plausible if I'm plotting lots of different types of variables with very different units and scales (e.g., pressure, temperature, wind speed). I would rather not need to add explicitly `vmin, vmax = data.min(), data.max()` (or worse, `vmin, vmax = np.nanpercentile(data, [2, 98])` to replicate the `robust=True` logic). We could also add logic such that if _both_ `vmin` and `vmax` are provided _and center is not provided_, a divergent colormap is never used. This seems pretty reasonable to me, given that providing both should be redundant in the case of a divergent colormap. However, I don't think this is a substitute for `center=False`, given the use case I describe above. Finally, I do agree with @fmaussion that it is bad practice to override either `vmin` or `vmax`. I think this could be entirely independent of the default colormap logic, though. 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`. These three changes seems relatively straightforward to implement (if slightly more complex than what we currently have), but we won't really know until someone tries. If both of you guys think these are good ideas, then I would suggest @fmaussion should get started with a PR, either against seaborn or xray. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154921317,https://api.github.com/repos/pydata/xarray/issues/642,154921317,MDEyOklzc3VlQ29tbWVudDE1NDkyMTMxNw==,315810,2015-11-09T04:48:12Z,2015-11-09T04:48:12Z,NONE,"> Seaborn currently doesn't have any notion of ""divergent"" colormaps without breakpoints (beyond explicitly providing one with the cmap argument, but that doesn't trigger the divergent colormap logic currently). To be honest, I'm not sure there's a use case for that -- the only place where I would want to default a breakpoint is around zero, which is straightforward enough to signal with center=0. My point is, there should be a way to use `vmin`, `vmax`, and `center` together and have them all do what they are expected to. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154919901,https://api.github.com/repos/pydata/xarray/issues/642,154919901,MDEyOklzc3VlQ29tbWVudDE1NDkxOTkwMQ==,1217238,2015-11-09T04:44:40Z,2015-11-09T04:44:40Z,MEMBER,"> Also, the ideal behavior really when you are plotting a diverging colormap and have provided vmin and vmax is to change the colormap itself so the breakpoint is at the data center but the limits are as provided. Seaborn currently doesn't have any notion of ""divergent"" colormaps without breakpoints (beyond explicitly providing one with the `cmap` argument, but that doesn't trigger the divergent colormap logic currently). To be honest, I'm not sure there's a use case for that -- the only place where I would want to default a breakpoint is around zero, which is straightforward enough to signal with `center=0`. > For some reason I thought that was an implementation detail, although I'm having trouble pulling up a reference. Seems weird to test is False. I agree it's weird and usually a code smell. But I have seen it used in a number of places, especially when it's useful to distinguish a boolean from a default value. For example, you can find it in both the numpy and pandas code bases: https://github.com/numpy/numpy/search?l=python&q=%22is+False%22&type=Code&utf8=%E2%9C%93 https://github.com/pydata/pandas/search?l=python&q=%22is+False%22&type=Code&utf8=%E2%9C%93 ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154918199,https://api.github.com/repos/pydata/xarray/issues/642,154918199,MDEyOklzc3VlQ29tbWVudDE1NDkxODE5OQ==,315810,2015-11-09T04:33:15Z,2015-11-09T04:33:15Z,NONE,"For some reason I thought that was an implementation detail, although I'm having trouble pulling up a reference. Seems weird to test `is False`. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154918112,https://api.github.com/repos/pydata/xarray/issues/642,154918112,MDEyOklzc3VlQ29tbWVudDE1NDkxODExMg==,1217238,2015-11-09T04:31:55Z,2015-11-09T04:31:55Z,MEMBER,"> I just mean practically, how do you tell the difference between 0 and False in Python code? Use `is`: `False is 0` is `False`, even on Python 2: ``` In [7]: False is 0 Out[7]: False In [8]: 0 is 0 Out[8]: True In [9]: False is False Out[9]: True ``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154918082,https://api.github.com/repos/pydata/xarray/issues/642,154918082,MDEyOklzc3VlQ29tbWVudDE1NDkxODA4Mg==,315810,2015-11-09T04:31:29Z,2015-11-09T04:31:29Z,NONE,"Also, the ideal behavior really when you are plotting a diverging colormap and have provided `vmin` and `vmax` is to change the colormap itself so the breakpoint is at the data center but the limits are as provided. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-154915488,https://api.github.com/repos/pydata/xarray/issues/642,154915488,MDEyOklzc3VlQ29tbWVudDE1NDkxNTQ4OA==,315810,2015-11-09T04:18:52Z,2015-11-09T04:18:52Z,NONE,"> We already distinguish between center=None and center=0 inside the logic for color limits, so I don't think this would be too much worse. I just mean practically, how do you tell the difference between `0` and `False` in Python code? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-153136423,https://api.github.com/repos/pydata/xarray/issues/642,153136423,MDEyOklzc3VlQ29tbWVudDE1MzEzNjQyMw==,10050469,2015-11-02T19:44:11Z,2015-11-02T19:44:11Z,MEMBER,"I would prefer that vmin or vmax to be _never_ ignored. When either one is provided then fall back to the default cmap ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-153125033,https://api.github.com/repos/pydata/xarray/issues/642,153125033,MDEyOklzc3VlQ29tbWVudDE1MzEyNTAzMw==,315810,2015-11-02T19:00:11Z,2015-11-02T19:00:11Z,NONE,"You could also just change the logic so that if both `vmin` and `vmax` are provided, they get used, although I'm not sure what that says about the default colormap to use. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-153124715,https://api.github.com/repos/pydata/xarray/issues/642,153124715,MDEyOklzc3VlQ29tbWVudDE1MzEyNDcxNQ==,315810,2015-11-02T18:58:50Z,2015-11-02T18:58:50Z,NONE,"`center=False` seems like it will collide with `center=0` in surprising ways, but I agree that avoiding an additional kwarg would be ideal. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415 https://github.com/pydata/xarray/issues/642#issuecomment-153123881,https://api.github.com/repos/pydata/xarray/issues/642,153123881,MDEyOklzc3VlQ29tbWVudDE1MzEyMzg4MQ==,1217238,2015-11-02T18:55:35Z,2015-11-02T18:55:35Z,MEMBER,"Agreed, this seems like a gap in the current logic. I copied the divergent colormap logic from Seaborn's `heatmap`, and if possible I would like to keep xray's logic here in sync. So it would also be nice to fix this upstream, if possible. @mwaskom any thoughts on adding the `divergent` keyword to `sns.heatmap`? Or maybe it would be better to reuse `center` (e.g., `center=False`) to indicate that the colormap really shouldn't be divergent? The issue is that it's sometimes possible to get stuck with a divergent colormap even if you really don't want one. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,114576415