QwtPlot Change Axis Title Alignment
Hello,
I'm trying to put the axis title in the top of the yLeft axis (instead of the default behaviour which is on the left) and I can't figure out how this can be done. I have seen that in qwt 4.2 used to be a method called QwtPlot::setAxisTitleAlignment, I guess it did what I need but I haven't found any equivalent in qwt 5.2.1. Does anybody know if this can be done?
Thank you very much
César
Re: QwtPlot Change Axis Title Alignment
Try with this:
Code:
plot
->axisScaleDraw
(QwtPlot::yLeft)->setAlignment
(Qt
::AlignTop);
I hope that helps.
Regards.
3 Attachment(s)
Re: QwtPlot Change Axis Title Alignment
Thank you for your answer gutiory :D, unfortunately it doesn't work as I expected, I have used:
plot->axisScaleDraw(QwtPlot::yLeft)->setAlignment(QwtScaleDraw::TopScale)
But the result is that the entire alignment of the axes change, I would like to change the alignment of the title, in fact I have been thinking that I was wrong, more than the alignment, I would like to change the position of the title to the top of the yLeft axes vertical line (I guess this can not be done with the alignment, I'm not sure). I have attached a few pictures to show my idea. What I would like to obtain is 'desired_result.jpg'. In 'result_setAlignment.jpg' is what I get when I use the setAligment method of the QwtScaleDraw and the current aspect of my plots is in 'result_without_setAlignment.jpg'
Anyway thanks a lot for your help!
result_setAlignment.jpg:
Attachment 4999
result_without_setAlignment.jpg:
Attachment 5001
desired_result.jpg:
Attachment 5000
Re: QwtPlot Change Axis Title Alignment
I'm facing the same problem, does anyone has an answer?
Re: QwtPlot Change Axis Title Alignment
The alignment of the scaleDraw is about how the scaleDraw is aligned to the plot canvas. If you want to align the axis title of a scale widget you have to change the alignment flags of the corresponding QwtText object ( QwtText::setRenderFlags() ).
But even if you have aligned the title somehow you can't rotate it.
Uwe
Re: QwtPlot Change Axis Title Alignment
thank you. I solved the problem by painting the "axis title" with QPainter::drawText in MyPlot : : paintEvent().