Results 1 to 3 of 3

Thread: Can I set QwtPlot axis scale non-consecutive?

  1. #1
    Join Date
    Jun 2008
    Posts
    18
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Question Can I set QwtPlot axis scale non-consecutive?

    e.g. say I have a data set of 2000 points, but I only want to display x-axis scale of values in these ranges: [0, 100], [300, 500], [1900, 1999], in one qwtplot, is it possible?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Can I set QwtPlot axis scale non-consecutive?

    So, are you saying you want the x-axis to show only the ranges [0,100],[300,500],[1900,2000) without a gap in between? (That is, 100 and 300 are right next to each other)?

    This can be done, but it won't be easy. You will need to implement custom scale engine and scale draw classes for the X axis and substitute them for the default ones. The scale map class for the x-axis will be ugly, too, since every x value between 100 and 300 has to map to the same x pixel.

    You might get some ideas looking at the histogram example.

    Another way to maybe accomplish the same thing with much less work would be to stack multiple plots side-by-side, each one with only the small x sub-range needed. Make the y axis visible only for the left-most plot, and put the x-axis title only on the plot that is right-most (or maybe the center one, whatever you prefer).

    You would need to synchronize the y-axes of all three plots so they had the same range, but otherwise the standard QwtPlotCurve code would take care of everything else.

    If you don't want to have three copies of your data (one for each curve), make a QwtData object to wrap it and use that to get the data into the curves.

  3. #3
    Join Date
    Jun 2008
    Posts
    18
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can I set QwtPlot axis scale non-consecutive?

    Thank you, d_stranz! Your assumption is correct. I adopted the same method as your second suggestion, it is the easiest way.

Similar Threads

  1. Replies: 1
    Last Post: 21st April 2010, 03:54
  2. Refresh axis scale drawing
    By jmsbc in forum Qwt
    Replies: 1
    Last Post: 14th June 2009, 15:45
  3. qwp plot axis scale
    By Cal in forum Qwt
    Replies: 1
    Last Post: 11th May 2009, 18:10
  4. Axis with a probability scale
    By Lister in forum Qwt
    Replies: 1
    Last Post: 5th May 2009, 07:45
  5. 4 axis auto scale..
    By Vincenzo in forum Qwt
    Replies: 0
    Last Post: 22nd March 2009, 02:12

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.