python - AttributeError:将 ytickslabels 设置为摄氏度时,模块“matplotlib.pyplot”没有属性“set_ytickslabels”
问题描述
我正在尝试通过使用以摄氏度为单位在 y 轴刻度上设置我的值
plt.get_yticks=np.arange(-40,40,10)
plt.set_ytickslabels('{}C'.format('\u00b0'))
我知道我可能在 set_ytickslabels 中做错了?
我之前的代码:`
plt.figure(figsize=(10,6))
ax = plt.gca()
plt.plot(dates, df1['Values'], '-b',dates, df2['Values'], '-r')
ax.set_xlim(dates[0],dates[364])
这给出了错误消息。如果我更改为ax.set_ytickslabels('{}C'.format('\u00b0'))
,我会收到相同的错误消息,'AttributeError: 'AxesSubplot' object has no attribute 'set_ytickslabels')
。
<ipython-input-35-bc07fa12bc0e> in <module>()
46 #ax.set_yticklabels(maxtemp15['MaxRecord15']{}C.format('\u00b0'))
47 #ax.set_yticklabels(map(lambda x: '{:}$^\circ$C'.format(x),ax.get_yticks()))
---> 48 plt.set_ytickslabels('{}C'.format('\u00b0'))
AttributeError: module 'matplotlib.pyplot' has no attribute 'set_ytickslabels'
解决方案
推荐阅读
- javascript - ipcRenderer.on 没有接收(不工作)
- nativescript - NativeScript-Vue - 组件不刷新,但 app.js 会
- google-apps-script - 查找 Google Meet 特定的开始时间以参加会议
- c++ - 如何让 Visual Studio CMake 使用 C/++ Lanuch for minGW/Cygwin (gdb)
- c++ - 在 MacOS 上安装 Boost C++ 库
- python-3.x - 重新缩放强度给出暗图像
- rest - 自 Xamarin Froms 4.5.0.356 以来 HttpClient 的问题
- pandas - total= df.isnull().sum(), percent1= df.count(),percent= df.isnull().count() 有什么区别?
- geolocation - Ionic 5 - 原生 geoloc 问题
- node.js - 如何增加firebase auth token的到期时间,我不想使用firebase客户端,有没有办法只在后端做某事