python - 为什么在 Spyder 中使用 sns.set_palette 会出错?
问题描述
我正在尝试使用以下方法在 Spyder 的 Python 脚本中设置 seaborn 调色板:
import seaborn as sns
sns.set_palette("Reds")
作为参数传递的调色板并不重要,我总是得到以下错误:
Traceback (most recent call last):
File "<ipython-input-20-efc46ee41836>", line 1, in <module>
sns.set_palette("Reds")
File "c:\users\lucas-magalhaes\anaconda3\lib\site-packages\seaborn\rcmod.py", line 550, in set_palette
mpl.rcParams['axes.prop_cycle'] = cyl
File "c:\users\lucas-magalhaes\anaconda3\lib\site-packages\matplotlib\__init__.py", line 679, in __setitem__
raise ValueError(f"Key {key}: {ve}") from None
ValueError: Key axes.prop_cycle: object was not a string or Cycler instance: cycler('color', [(0.9950634371395617, 0.8596539792387543, 0.7986620530565167), (0.9882352941176471, 0.6866743560169165, 0.5778854286812765), (0.9865897731641676, 0.5067281814686659, 0.38123798539023457), (0.9570011534025374, 0.3087120338331411, 0.22191464821222606), (0.8370472895040368, 0.13394848135332565, 0.13079584775086506), (0.6663437139561708, 0.06339100346020761, 0.08641291810841982)])
这在 Jupyter 中运行良好,但在 Spyder 中却不行。知道为什么吗?
解决方案
推荐阅读
- git - Github 突然无法连接
- laravel - 图片上传在 Laravel 中返回 500(出现问题。看起来服务器无法加载您的请求)
- nlp - Bert 针对语义相似性进行了微调
- postgresql - 带有 Jack Rabbit 橡木实现的 SpringBoot 应用程序启动时间过长
- javascript - 突出显示 JavaScript/React 时 Visual Code 中下拉菜单的快捷方式
- html - background-image: url() 适用于桌面上的所有文件但不适用于其文件夹中的文件
- javascript - Redux(w/immer)状态不更新动作
- caching - 重定向时 TYPO3 扩展控制器中的缓存问题
- javascript - 如何在本机反应中访问标题选项卡导航中的变量
- blockchain - Metamask stopping to inject web3.js