pythonplotchaco

Xlabel on chaco plot without creating new axis


I have a Chaco ToolBarPlot and simply want to set the xlabel to "Wavelength". In matplotlib, obviously it would be:

plt.xlabel('Wavelength')

In Chaco, I thought it would be (from within the class):

self.plot.index_axis.label = 'Wavelength'

But all of the examples I can find build a new axis object entirely. For example:

label_axis = LabelAxis(plot, orientation='bottom', ...) plot.index_axis = label_axis

This seems like overkill... Is it possible to set the axis label without creating a new axis? Part of the reason it's a pain is that I have to change this trait dynamically, and it can take on a lot of different values depending on what the user is doing in the UI.


Solution

  • IIUC the desired attribute is title not label. See: http://docs.enthought.com/chaco/user_manual/basic_elements/overlays.html#overlays-axis-legend-grid-etc http://osdir.com/ml/python-enthought-devel/2009-09/msg00204.html