我正在尝试在 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/