Results 1 to 13 of 13

Thread: Remove space between axis and plot

  1. #1
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Remove space between axis and plot

    Hey,

    I'm doing my first steps with qwt for a new project, but I have run in some little problems. I try to remove the space between the x-axis and the the plot so that the x-axis is located on the baseline. But I don't get it work. This is my current approach:
    Qt Code:
    1. ui->qwt_Curve->plotLayout()->setAlignCanvasToScales(true);
    2. ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->setMargin(0);
    3. ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->setSpacing(0);
    4. ui->qwt_Curve->axisWidget(QwtPlot::xBottom)->scaleDraw()->setMinimumExtent(0);
    5. ui->qwt_Curve->plotLayout()->setCanvasMargin(0, QwtPlot::xBottom);
    To copy to clipboard, switch view to plain text mode 

    Do you have any hints for me?
    Thanks and best regards
    Ozzy

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

    Default Re: Remove space between axis and plot

    Qt Code:
    1. dynamic_cast<QFrame*>(plot->canvas())->setFrameStyle( QFrame::NoFrame );
    2. plot->axisWidget(QwtPlot::xBottom)->setMargin(0);
    To copy to clipboard, switch view to plain text mode 

    Uwe

  3. #3
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Hi,

    thanks for your reply. But there is still a very small space between the zero line and the axis-line. Is there any further trick to remove this and set the baseline to the zero line?

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

    Default Re: Remove space between axis and plot

    Quote Originally Posted by Ozzy View Post
    thanks for your reply. But there is still a very small space between the zero line and the axis-line.
    What zero line ?

    Uwe

  5. #5
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Hi,

    when I plot a chart with only zero points (e.g. System load on a cpu with no load..) there is still a small space between the zero line and the axis.

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

    Default Re: Remove space between axis and plot

    Again: what do you mean by "zero line" - the position of some value 0 of a y axis ?

    Uwe

  7. #7
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Right. The position of zero values on the x-axis (bottom).

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

    Default Re: Remove space between axis and plot

    Better upload a screenshot of what you want to do.

    Uwe

  9. #9
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Hi,

    plot.png

    Here you can see that the points with 0.0 on the x axis are not on but above the axis. I hope it is getting clearer now.

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

    Default Re: Remove space between axis and plot

    Please add gridlines for the y axis ( maybe in red ) and set the canvas background to cyan and upload another screenshot.

    Uwe

  11. #11
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Hi,

    this is the new plot:
    plot.png

    Thanks and best regards
    Ozzy

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

    Default Re: Remove space between axis and plot

    Where you can see, that the zero line ( 0 at y left ) is exactly the first pixel in the canvas.

    You could disable the backbone of the scales ( see QwtScaleDraw ) and draw a line at y=0 inside the canvas - if this is what you want to do.

    Uwe

  13. #13
    Join Date
    Nov 2007
    Posts
    21
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Remove space between axis and plot

    Hi,

    thanks for your reply! This works for me!!!

    Thanks and best regards
    Ozzy

Similar Threads

  1. Axis not fit with the plot
    By Nicho in forum Qwt
    Replies: 14
    Last Post: 28th June 2013, 13:28
  2. Remove space in VBoxLayout
    By Troebadoer in forum Newbie
    Replies: 1
    Last Post: 2nd June 2011, 06:18
  3. Replies: 9
    Last Post: 3rd May 2011, 22:21
  4. How to remove Space Between 2 QHBoxLayout Widget
    By jaya in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2010, 23:57
  5. Blank space at right side of plot
    By liversedge in forum Qwt
    Replies: 2
    Last Post: 14th August 2010, 14:02

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.