I am trying to add several text labels to my Chaco Polygon Plot. My Polygon Plot works fine, however, I can't work out how to get the text labels to appear at custom locations on the plot.
I think I need to use the chaco.plot_label.PlotLabel object. However, even when I define a location or x and y in the constructor, the PlotLabel text always appears in the same location (overlaying the title). How do I get the plot label to actually appear on the plot and which argument in the constructor do I use to control its location?
self.polyplot.overlays.append(PlotLabel(text=config,component=self.polyplot, location=(nxarray[0],energy)))
(I can provide more code if necessary)
Does anyone have an example of implementing text labels on a Chaco plot?
Thanks in advance
You don't want to use a PlotLabel
but a DataLabel
instead. There is a good example of custom labels put around a Chaco plot in the following example:
https://github.com/enthought/chaco/blob/master/examples/demo/data_labels.py
and the result looks like this: