PDA

View Full Version : QwtPlot, how to remove gap between xBottom axis and yLeft?



Renat
6th December 2010, 11:36
Hello!
I have some code:

...
QwtPlot *MyPlot = new QwtPlot;
...

By default, Qwt plot inserts gap between 0 at Ox axis and 0 at Oy axis.
how to remove gap between xBottom axis and yLeft (in the left bottom corner)?


when I do:
...
MyPlot->axisWidget(QwtPlot::xBottom)->setMargin(0);
MyPlot->axisWidget(QwtPlot::yLeft)->setMargin(0);
...
gap is decrease by factor two.

I need to remove gap at all.


Here (http://qwt.sourceforge.net/) you can see it (with gap).

QtDeveloper
28th August 2011, 11:31
I am facing the same problem. Can somebody provide a solution?
Thanks in advance.

Uwe
28th August 2011, 11:46
Check the examples - at least one of them should demonstrate the combination you are looking for.

Uwe

QtDeveloper
29th August 2011, 10:52
Hello Uwe,

Thanks a lot. I found the refreshtest example, which does something very similar that I can definitely use.

I have another question. When I am creating a QwtPlot with a frame as the parent, it seems there is a margin of 4 pixels between the ticks and the frame border. How can I remove this spacing too, so that ticks start from the frame boundary? The frame applies QHBoxLayout with no margin/spacing and at present the QwtPlot is the only control there.

Thanks in advance,

Uwe
31st August 2011, 13:57
plot->plotLayout()->setAlignCanvasToScales( true );
plot->canvas()->setLineWidth( 0 );
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
{
plot->axisWidget( axis )->setMargin( 0 );
plot->axisScaleDraw( axis )->enableComponent(
QwtAbstractScaleDraw::Backbone, false );
}Decide yourself which of these settings you want to have on your plot,

Uwe