Re: legends

Rene Brun (Rene.Brun@cern.ch)
Tue, 10 Jun 1997 17:12:53 +0200


Wolfgang Korsch wrote:
>
> Hi,
> how can I use markers for legends in a figure?
> I have different sets of data and I'd like them to display in a
> single plot using different marker styles/colors for the data sets.
> Now I'd like to explain the different sets in a legend, e.g.
> blue squares = data 1, circle = data 2, .....
> Is there an easy way to use a marker type in the legend?
> Thanks.
>

We do not have a function to do this directly. What you can do:
TMarker *m = new TMarker(x,y,marker);
m->SetMarkerColor(..); //set all marker attributes
m->Draw();
TText *legend = new TText(x+epsi,y,"legend");
legend->SetTextColor(..); //set legend attributes
legend->Draw();

One could imagine a dedicated class TLegend
or/and specialized functions in TH1 and TGraph (the histo and graph
objects already know all attributes) to position a legend.
Comments ?

Rene Brun