issues: 490229690
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
490229690 | MDU6SXNzdWU0OTAyMjk2OTA= | 3284 | specifying list of colors does not work for me | 10194086 | closed | 0 | 1 | 2019-09-06T09:36:08Z | 2019-09-09T18:31:16Z | 2019-09-09T18:31:16Z | MEMBER | MCVE Code Sample```python import xarray as xr import numpy as np airtemps = xr.tutorial.load_dataset('air_temperature') air = airtemps.air.isel(time=0) levels = np.arange(225, 301, 25) colors = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'] this does not work for meair.plot.pcolormesh(levels=levels, colors=colors) ``` Expected OutputShould create a plot with the specified colors. According to the the docstring this should work. Or maybe I am doing something wrong here? Problem DescriptionInstead I get the following error: ```python /usr/local/Miniconda3-envs/envs/2019/envs/iacpy3_2019/lib/python3.7/site-packages/xarray/plot/utils.py in _process_cmap_cbar_kwargs(func, kwargs, data) 683 # colors is only valid when levels is supplied or the plot is of type 684 # contour or contourf --> 685 if colors and (('contour' not in func.name) and (not levels)): 686 raise ValueError("Can only specify colors with contour or levels") 687 ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ``` Instead I use the following, which works:
Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3284/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |