Search code examples
pythonmatplotlibtitlecolorbaraplpy

APLpy error: 'Colorbar' object has no attribute 'set_axis_label_text'


I'm trying to write a title for a colour bar in APLpy but everytime I do I get the following error:

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

The code I'm using is the following:

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()

According to read the docs this should work http://aplpy.readthedocs.org/en/v0.9.9/quick_reference.html


Solution

  • Please update APLpy to the newest version. I've looked everywhere but I did not even find anything on 0.9.6. So probably the method was introduced in a later release.

    I think setting labels for colorbars was introduced in 0.9.9 in pull request #93.