Legend title in tgraph2d

hi everybody,
i’ve written a small script that plots a 2d colored graph with a legend to the right (see the image in the attachments).
i’d like to put some text close to the legend. is there a way to make it?
you can find the script in the attachment.

thank you in advance for your answers :slight_smile:
grafico2d.C (3.39 KB)
mappa_tot-eps-converted-to.pdf (12.7 KB)

What you call the “legend” is the palette I guess ?
What you call “some text close to the legend” is the axis title ?

in that case do:

g->GetZaxis()->SetTitle("some text close to the legend");

you might nee to change the right margin with:

c1->SetRightMargin(...);

yes, sorry. what i call “legend” is the palette, and i want to add a formula to its right.
i don’t want add the z axis label :slight_smile:

Z title … it is a text next to the axis … that’s what you want ? no ?

palette should be some kind of “legend”, isn’t it?
or is it the z axis?
i’m asking because i tried to add the line you told me, but it doesn’t show any text… o.O

The palette has an axis it is the Z-Axis because it shows the Z content of the data …
Please try what I suggested it should be fine …

i’m serious!
i added this:

below the commands that draw the x and y labels.
i also enlarged the right margin, but still nothing appears.

you can say that it doesn’t work because that title cannot be shown (let’s say “it’s too ugly because it’s latex… somehow”). but i tried to change it with something simple, like:

still… nothing appears o.O
and i got no errors too…

Ok, try:

 [...]
  g->GetXaxis()->SetTitle("x (cm)");
  g->GetYaxis()->SetTitle("y (cm)");
  TText *t = new TText(0.,1.,"Z Legend");
  t->Draw();
  gPad->Update();
  gPad->Modified();
[...]