python - APLpy错误: 'Colorbar' object has no attribute 'set_axis_label_text'

标签 python matplotlib title colorbar aplpy

我正在尝试在 APLpy 中为颜色条编写标题,但每次这样做都会收到以下错误:

AttributeError:'Colorbar' object has no attribute 'set_axis_label_text'

我使用的代码如下:

import aplpy
import matplotlib.pyplot as plt
fig = plt.figure()
f1 = aplpy.FITSFigure('random.fits', figure=fig)
f1.show_colorscale(stretch='arcsinh',cmap='Greys',interpolation="bicubic")
f1.add_colorbar()
f1.colorbar.set_width(0.3)
f1.colorbar.set_axis_label_text('title')
plt.show()

根据阅读文档,这应该可行 http://aplpy.readthedocs.org/en/v0.9.9/quick_reference.html

最佳答案

请将 APLpy 更新到最新版本。我到处都找过了,但在 0.9.6 上我什至没有找到任何东西。因此该方法可能是在以后的版本中引入的。

我认为设置颜色条标签是在 0.9.9 中引入的在 pull request #93 .

关于python - APLpy错误: 'Colorbar' object has no attribute 'set_axis_label_text' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35271978/

相关文章:

python - 根据字符串列表递归检查 txt 文件内容

python - 当刻度标签位于顶部时,Seaborn 热图 xticklabels 水平对齐不起作用

python - 定义堆积条形图中每个条形的底部

jquery - 使用属性 'title' 更改 css 项

iphone - UINavigationBar 中的中心自定义标题?

url - SEO 网址的最佳实践(ASCII 与 urlencoded UTF8)?

python - Elasticsearch - field_value_factor,缺少参数

python - Django 2 : TemplateDoesNotExist even if files placed properly

python - 同时使用 python3 和 python 2.7 时出现 numba 类型错误

python - Python 中函数的彩色网格图