0

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

user2175850
  • 193
  • 2
  • 13

1 Answers1

4

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:enter image description here

jonathanrocher
  • 1,200
  • 7
  • 10
  • Thanks this should solve my problem. I had seen the DataLabel Object but from the example I saw I thought it could only label a point as (x,y). I didn't realise it could have custom text. Thanks! – user2175850 Mar 18 '14 at 22:41