Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## Re: Ensuring visibility of labels at edge of plot.

 Re: Ensuring visibility of labels at edge of plot. From: Uwe Rathmann - 2005-11-30 21:08:32 ```On Wednesday 30 November 2005 20:52, Gerard Vermeulen wrote: > > But I=B4m afraid this is not so easy with PyQwt. > > Why? Because I don't know Python and I=B4m always afraid of things I don't know. cu, Uwe ```

 Ensuring visibility of labels at edge of plot. From: Truls A. Tangstad - 2005-11-29 09:14:36 ```Is it possible to ensure that labels on plot markers are taken into consideration when autoscaling/zooming the plot? It seems that only the marker position itself affects the area shown. Just to clearify what I'm trying to achieve, i've included a short python-snippet creating a simple sinus-curve, and a marker with a label.The problem shouldn't be python-specific though, which is why I'm posting here. On replotting, the x-axis goes from 0 to 100 and y-axis from -1 to 2, displaying both curve and marker. The label though is mostly hidden as only the starting letter is within view. I'm using PyQwt 4.1, based on Qwt 4.2.0. from qwt import * from qt import * import math app =3D QApplication([]) plot =3D QwtPlot() # create a sinus curve from x=3D0 to x=3D99 and y within +/- 1.0 curve =3D plot.insertCurve("My curve") plot.setCurveData(curve, range(100), map(lambda i : math.sin(2*math.pi*i/100), range(100))) # place a labeled marker top-right m =3D QwtPlotMarker(plot) m.setXValue(100) m.setYValue(2) print m, type(m), dir(m) m.setLabel("Marker") m.setLabelAlignment(Qt.AlignRight) plot.insertMarker(m) plot.show() plot.replot() QObject.connect(app, SIGNAL("lastWindowClosed()"), app.quit) app.exec_loop() Guess that's a long and complicated post about a simple problem... -- Truls A. Tangstad - tangstad at scicraft dot org ```
 Re: Ensuring visibility of labels at edge of plot. From: Uwe Rathmann - 2005-11-30 07:48:01 ```On Tuesday 29 November 2005 10:14, Truls A. Tangstad wrote: > Is it possible to ensure that labels on plot markers are taken into > consideration when autoscaling/zooming the plot? Not with Qwt 4.2.0. Here you have to do the scaling on your own. A solution might be to adjust the alignment of the label texts to the inner= =20 side of the position. In Qwt 5.x the bounding rect of plot items with an enabled=20 QwtPlotItem::AutoScale attribute have an effect on autoscaling.=20 Here it is possible to overload QwtPlotMarker::boundingRect to add the spac= e=20 for the text label. But I=B4m afraid this is not so easy with PyQwt. Uwe ```
 Re: Ensuring visibility of labels at edge of plot. From: Truls A. Tangstad - 2005-11-30 07:57:33 ```On 11/30/05, Uwe Rathmann wrote: > On Tuesday 29 November 2005 10:14, Truls A. Tangstad wrote: > > Is it possible to ensure that labels on plot markers are taken into > > consideration when autoscaling/zooming the plot? > Not with Qwt 4.2.0. Here you have to do the scaling on your own. > A solution might be to adjust the alignment of the label texts to the inn= er > side of the position. > In Qwt 5.x the bounding rect of plot items with an enabled > QwtPlotItem::AutoScale attribute have an effect on autoscaling. > Here it is possible to overload QwtPlotMarker::boundingRect to add the sp= ace > for the text label. > > But I=B4m afraid this is not so easy with PyQwt. Thanks for your reply. The first option might actually be a nice compromise for some situations. Shouldn't it be possible though to overload QwtPlotMarker::boundingRect pretty easily from python (when PyQwt starts supporting Qwt 5.x atleast)? -- Truls A. Tangstad - tangstad at scicraft dot org ```
 Re: Ensuring visibility of labels at edge of plot. From: Gerard Vermeulen - 2005-11-30 19:53:04 ```On Wed, 30 Nov 2005 08:56:35 +0100 Uwe Rathmann wrote: > On Tuesday 29 November 2005 10:14, Truls A. Tangstad wrote: >=20 > > Is it possible to ensure that labels on plot markers are taken into > > consideration when autoscaling/zooming the plot? >=20 > Not with Qwt 4.2.0. Here you have to do the scaling on your own. > A solution might be to adjust the alignment of the label texts to the inn= er=20 > side of the position. >=20 > In Qwt 5.x the bounding rect of plot items with an enabled=20 > QwtPlotItem::AutoScale attribute have an effect on autoscaling.=20 > Here it is possible to overload QwtPlotMarker::boundingRect to add the sp= ace=20 > for the text label. >=20 > But I=B4m afraid this is not so easy with PyQwt. >=20 Why? Gerard ```
 Re: Ensuring visibility of labels at edge of plot. From: Uwe Rathmann - 2005-11-30 21:08:32 ```On Wednesday 30 November 2005 20:52, Gerard Vermeulen wrote: > > But I=B4m afraid this is not so easy with PyQwt. > > Why? Because I don't know Python and I=B4m always afraid of things I don't know. cu, Uwe ```