From: Jean-Baptiste C. <jc...@de...> - 2004-05-13 15:24:47
|
S=E6ll ! I was simply planning to be able to move between the default positions 'upp= er 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=3DFigure.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=20 between Upper Right and Upper Left """ =20 if self.Legend_button.get_active()=3D=3D1: self.Legend_button.set_label("Upper Right") else: self.Legend_button.set_label("Upper Left") self.leg._offset(0.1,0.56) self.draw() =20 return When I toggle the button, the label changes, but the legend is unmoved. Am I missing something ?=20 Takk Jean-Baptiste On Thu, 13 May 2004 05:20:28 -0500 John Hunter <jdh...@ni...> wrote: > >>>>> "Jean-Baptiste" =3D=3D Jean-Baptiste Cazier <jc...@de...> wri= tes: >=20 > 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 ? >=20 > 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 >=20 > leg._offset(0.05, 0.10) >=20 > 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. >=20 > As always you'll need to call canvas.draw after setting the new legend > location. > =20 >=20 > JDH --=20 ----------------------------- Jea...@de... Department of Statistics deCODE genetics Sturlugata,8 570 2993 101 Reykjav=EDk |