Re: Draw text on top of both canvas and plot background?
Brought to you by:
rathmann
|
From: Elvis S. <elv...@or...> - 2019-03-12 09:32:39
|
Den tis 12 mars 2019 kl 09:31 skrev Tigertal <Uwe...@ti...>: > > > and attached a picture showing exactly where I want to draw the text. > > Your image does not explain if you want to have the text inside the top > scale widget: In the image I painted the text exactly where I want it, which is below the axis, partly inside the canvas and partly inside the plot background. But you're right I should have given the canvas a different background to make it clear (even if the other image shows where the "g" is cropped, so shows where the canvas boundary is). I'm attaching a picture where I've made the canvas background blue to make it clear. The image shows my attempt with overriding paintEvent, note how the "g" is cropped by the canvas which is painted over it. Elvis > - below the axis Yes, below the axis, over the canvas and over the plot background. So spanning the canvas boundary. > - between ticks ( do you have them ? ) and tick labels No, not between ticks. I do not have ticks in the top axis (see the picture). > > or inside the canvas, or totally unrelated to both. Partly inside the canvas (that's my problem, with the text in the position where I want it, it is partly inside the canvas, and partly outside (over the plot background)). > > And what about the scale widget at the right ? I do not have a scale widget at the right. Only a top and left axis (as shown in the image). I don't want to add a scale widget to the right, because my goal is to add the unit without increasing the width of the plot as a whole. > > When giving the canvas a background color and/or a frame in your image > things would be much clearer. Please also show all axes you have in your > plot. The image shows all axes I have (top and left). I made the canvas blue in this version, to make it clear where the canvas boundary is. But, you suggested approach of appending "\nUnit" to the last tick label may actually be good enough. I have plently of vertical space, so the extra height this will add to the top axis may be OK. I will try it out! Elvis > > Note, that QwtPlot is a composite widget and and the implementation will > be totally different depending on the questions above. > > Uwe |