{"action":"created","issue":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7129","repository_url":"https://api.github.com/repos/matplotlib/matplotlib","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7129/labels{/name}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7129/comments","events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7129/events","html_url":"https://github.com/matplotlib/matplotlib/issues/7129","id":177644691,"number":7129,"title":"error using IpythonWidgets + Seaborn on Matplotlib-2.0.0b4","user":{"login":"stonebig","id":4312421,"avatar_url":"https://avatars.githubusercontent.com/u/4312421?v=3","gravatar_id":"","url":"https://api.github.com/users/stonebig","html_url":"https://github.com/stonebig","followers_url":"https://api.github.com/users/stonebig/followers","following_url":"https://api.github.com/users/stonebig/following{/other_user}","gists_url":"https://api.github.com/users/stonebig/gists{/gist_id}","starred_url":"https://api.github.com/users/stonebig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stonebig/subscriptions","organizations_url":"https://api.github.com/users/stonebig/orgs","repos_url":"https://api.github.com/users/stonebig/repos","events_url":"https://api.github.com/users/stonebig/events{/privacy}","received_events_url":"https://api.github.com/users/stonebig/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-09-18T10:44:12Z","updated_at":"2016-09-20T18:15:07Z","closed_at":null,"body":"Hi,\r\n\r\nExperimenting my usual list of test on Matplotlib-2.0.0b4, I get this error\r\n\r\n- [x] Matplotlib-2.0.0b4, Python-3.5.2, Windows10, Ipython-5.1.0, Ipywidget-5.2.2, Numpy-1.11.1  and pandas-0.19.0rc1 of of cgohlke, \r\n- [x] WinPython, matplotlib-3.0.0b4 from cgohlke\r\n- [x]  piece of code and image below\r\n- [x] was ok in WinPython with Matplotlib-1.5.2 (only Matplotlib may have changed since this) \r\n\r\nError:\r\n````\r\n%matplotlib inline\r\n# Pandas interactive\r\nimport pandas as pd\r\nimport numpy as np\r\nimport seaborn as sns\r\n\r\n# create a df with random datas\r\nnp.random.seed(24)\r\ndf = pd.DataFrame({'A': np.linspace(1, 10, 10)})\r\ndf = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],\r\n               axis=1)\r\ndf.iloc[0, 2] = np.nan\r\n\r\n# interactive\r\nfrom IPython.html import widgets\r\n@widgets.interact\r\ndef f(h_neg=(0, 359, 1), h_pos=(0, 359), s=(0., 99.9), l=(0., 99.9)):\r\n    return (df\r\n             .style\r\n             .background_gradient(\r\n                cmap=sns.palettes.diverging_palette(\r\n                     h_neg=h_neg, h_pos=h_pos, s=s, l=l, as_cmap=True)\r\n             ).highlight_null()\r\n           )\r\n````\r\n\r\n````\r\nC:\\WinPython\\basedir35\\buildQt5\\winpython-64bit-3.5.x.3\\python-3.5.2.amd64\\lib\\site-packages\\matplotlib\\colors.py:486: RuntimeWarning: invalid value encountered in less\r\n  cbook._putmask(xa, xa < 0.0, -1)\r\n````\r\n![matplotlib-20160918a](https://cloud.githubusercontent.com/assets/4312421/18615092/85539ce6-7d9d-11e6-85e4-efa19dd0ad57.PNG)\r\n"},"comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments/248385828","html_url":"https://github.com/matplotlib/matplotlib/issues/7129#issuecomment-248385828","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7129","id":248385828,"user":{"login":"jorisvandenbossche","id":1020496,"avatar_url":"https://avatars.githubusercontent.com/u/1020496?v=3","gravatar_id":"","url":"https://api.github.com/users/jorisvandenbossche","html_url":"https://github.com/jorisvandenbossche","followers_url":"https://api.github.com/users/jorisvandenbossche/followers","following_url":"https://api.github.com/users/jorisvandenbossche/following{/other_user}","gists_url":"https://api.github.com/users/jorisvandenbossche/gists{/gist_id}","starred_url":"https://api.github.com/users/jorisvandenbossche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorisvandenbossche/subscriptions","organizations_url":"https://api.github.com/users/jorisvandenbossche/orgs","repos_url":"https://api.github.com/users/jorisvandenbossche/repos","events_url":"https://api.github.com/users/jorisvandenbossche/events{/privacy}","received_events_url":"https://api.github.com/users/jorisvandenbossche/received_events","type":"User","site_admin":false},"created_at":"2016-09-20T18:15:07Z","updated_at":"2016-09-20T18:15:07Z","body":"So in the above example, `normed` is a masked array but where the data includes a NaN. It is this were the colormap gives a warning:\r\n\r\n```\r\nIn [3]: plt.cm.get_cmap('viridis')(np.array([np.nan, 1, 0.5]))\r\n/home/joris/miniconda3/envs/dev/lib/python3.5/site-packages/matplotlib/colors.py:581: RuntimeWarning: invalid value encountered in less\r\n  cbook._putmask(xa, xa < 0.0, -1)\r\nOut[3]: \r\narray([[ 0.267004,  0.004874,  0.329415,  1.      ],\r\n       [ 0.993248,  0.906157,  0.143936,  1.      ],\r\n       [ 0.127568,  0.566949,  0.550556,  1.      ]])\r\n\r\nIn [5]: plt.cm.get_cmap('viridis')(np.array([np.nan]))\r\nOut[5]: array([[ 0.267004,  0.004874,  0.329415,  1.      ]])\r\n```\r\n\r\nA strange thing is that it does not give the warning when it is a array with a single nan value.\r\n\r\nIs `cmap` supposed to be able to deal with NaNs? Or should we in pandas filter them out first?"}}
{"actor":{"display_login":"jorisvandenbossche"}}