Results 1 to 5 of 5

Thread: QwtPlot, how to remove gap between xBottom axis and yLeft?

  1. #1
    Join Date
    Dec 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtPlot, how to remove gap between xBottom axis and yLeft?

    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 you can see it (with gap).
    Last edited by Renat; 6th December 2010 at 14:54.

  2. #2
    Join Date
    Aug 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot, how to remove gap between xBottom axis and yLeft?

    I am facing the same problem. Can somebody provide a solution?
    Thanks in advance.

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot, how to remove gap between xBottom axis and yLeft?

    Check the examples - at least one of them should demonstrate the combination you are looking for.

    Uwe

  4. #4
    Join Date
    Aug 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtPlot, how to remove gap between xBottom axis and yLeft?

    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,

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,312
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlot, how to remove gap between xBottom axis and yLeft?

    Qt Code:
    1. plot->plotLayout()->setAlignCanvasToScales( true );
    2. plot->canvas()->setLineWidth( 0 );
    3. for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
    4. {
    5. plot->axisWidget( axis )->setMargin( 0 );
    6. plot->axisScaleDraw( axis )->enableComponent(
    7. QwtAbstractScaleDraw::Backbone, false );
    8. }
    To copy to clipboard, switch view to plain text mode 
    Decide yourself which of these settings you want to have on your plot,

    Uwe

Similar Threads

  1. findChildren<QwtPlot *>()
    By gib in forum Qwt
    Replies: 0
    Last Post: 23rd March 2010, 03:09
  2. QwtPlot margins
    By jmsbc in forum Qwt
    Replies: 0
    Last Post: 2nd October 2009, 18:11
  3. Replies: 6
    Last Post: 14th May 2009, 12:02
  4. Problem with QwtPlot
    By sudheer168 in forum Qwt
    Replies: 1
    Last Post: 11th September 2008, 09:04
  5. reset QwtPlot
    By sarefo in forum Qwt
    Replies: 1
    Last Post: 24th January 2008, 08:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.