home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 154915320

This data as json

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-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
Powered by Datasette · Queries took 0.668ms · About: xarray-datasette