Results 1 to 6 of 6

Thread: How to force plot grid to follow top axis?

  1. #1
    Join Date
    Mar 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default How to force plot grid to follow top axis?

    Hi Everybody,

    is there a possibility to snap the grid to the top axis?
    I.e. so that vertical lines of the grid will follow minors and major ticks of the axis.
    By default, it seems to be always snapped to the bottom one.

  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: How to force plot grid to follow top axis?

    Qt Code:
    1. grid->setXAxis( QwtPlot::xTop );
    To copy to clipboard, switch view to plain text mode 
    HTH,
    Uwe

  3. The following user says thank you to Uwe for this useful post:

    Sintegrial (11th November 2015)

  4. #3
    Join Date
    Mar 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to force plot grid to follow top axis?

    Thank you a lot Uwe!

    That was really stupid question, I should have look at QwtPlotItem interface of course

    Could you please tell is it also possible to get an axis with a non-regular scale?
    I.e. when the ticks are defined in a complete arbitrary way, say, by a table or so on.
    Playing around with QwtTransform did not bring a lot, actually.
    Or there is another approach to achieve this?

    btw, Qwt is great

  5. #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: How to force plot grid to follow top axis?

    Quote Originally Posted by Sintegrial View Post
    Could you please tell is it also possible to get an axis with a non-regular scale?
    When there is no rule use QwtPlot::setAxisScaleDiv(), otherwise the rule has to be implemented somehow using QwtScaleEngine/QwtTransform.

    Uwe

  6. #5
    Join Date
    Mar 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to force plot grid to follow top axis?

    I've tried to use setAxisScaleDiv() as a very simple test, like that:

    QwtScaleDiv scaleDiv(0.0, samplesCount);

    m_plotPtr->setAxisScaleDiv(QwtPlot::xBottom, scaleDiv);
    m_plotPtr->enableAxis(QwtPlot::xBottom, true);
    but unfortunately the bottom axis disappears after these lines

  7. #6
    Join Date
    Mar 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to force plot grid to follow top axis?

    Ok, found the reason: when there are no ticks set, the scala will not be drawn.
    Thank you again Uwe!

Similar Threads

  1. Replies: 7
    Last Post: 10th July 2013, 14:32
  2. Force format for Axis numbering
    By FreddyKay in forum Qwt
    Replies: 1
    Last Post: 28th June 2013, 07:42
  3. Replies: 1
    Last Post: 5th March 2012, 07:34
  4. Replies: 9
    Last Post: 3rd May 2011, 22:21
  5. Qwt plot + grid huge pdf file
    By giusepped in forum Qwt
    Replies: 3
    Last Post: 17th December 2008, 14:53

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.