move legend

Jean-Baptiste> S?ll ! I would like to be able to move my
    Jean-Baptiste> Figure.legend Because the optimal position of the
    Jean-Baptiste> legend on my figure is not always the same, I added
    Jean-Baptiste> a button to the navigation toolbar to give the suer
    Jean-Baptiste> a chance to choose the position of the legend I
    Jean-Baptiste> knwo that I can get a handle on my first legend
    Jean-Baptiste> drawing, but how can I just modify its location ?
    Jean-Baptiste> Is there a move_location method for the
    Jean-Baptiste> Figure.legend ?

There is currently no "move to" location, but there is an offset
method where you can supply a deltxa, deltay in relative sizes, in
your case fractions of the figure width and height. So if you wanted
to move the legend 5% of the figure width to the right and 10% of the
figure height up, you can call

  leg._offset(0.05, 0.10)

The leading underscore means that this method was intended for
internal use, and may change in future releases, but you can try it
and see if it works for you. If it does, I can probably make it
a public method for the next release.

As always you'll need to call canvas.draw after setting the new legend
location.

JDH

Sæll !

I was simply planning to be able to move between the default positions 'upper right', 'upper left', etc
But I believe I can use _offset.

However it did not produce much effect

I have defined the legend the following way:
canvas.leg=Figure.legend(canvas.figure,tuple([i[1] for i in d]),tuple([i[0] for i in d]),'best')

And then when I toggle a button I apply the following move with the canvas object, which is just a test offset

    def toggle_legend(self, event):
      """ Toggle the label in the legend button
          between Upper Right and Upper Left """
            
      if self.Legend_button.get_active()==1:
         self.Legend_button.set_label("Upper Right")
      else:
         self.Legend_button.set_label("Upper Left")

      self.leg._offset(0.1,0.56)
      self.draw()
  
    return

When I toggle the button, the label changes, but the legend is unmoved.

Am I missing something ?

Takk

Jean-Baptiste

···

On Thu, 13 May 2004 05:20:28 -0500 John Hunter <jdhunter@...8...> wrote:

    Jean-Baptiste> S_ll ! I would like to be able to move my
    Jean-Baptiste> Figure.legend Because the optimal position of the
    Jean-Baptiste> legend on my figure is not always the same, I added
    Jean-Baptiste> a button to the navigation toolbar to give the suer
    Jean-Baptiste> a chance to choose the position of the legend I
    Jean-Baptiste> knwo that I can get a handle on my first legend
    Jean-Baptiste> drawing, but how can I just modify its location ?
    Jean-Baptiste> Is there a move_location method for the
    Jean-Baptiste> Figure.legend ?

There is currently no "move to" location, but there is an offset
method where you can supply a deltxa, deltay in relative sizes, in
your case fractions of the figure width and height. So if you wanted
to move the legend 5% of the figure width to the right and 10% of the
figure height up, you can call

  leg._offset(0.05, 0.10)

The leading underscore means that this method was intended for
internal use, and may change in future releases, but you can try it
and see if it works for you. If it does, I can probably make it
a public method for the next release.

As always you'll need to call canvas.draw after setting the new legend
location.

JDH

--
-----------------------------
Jean-Baptiste.Cazier@...15...

Department of Statistics
deCODE genetics Sturlugata,8
570 2993 101 Reykjavík