Results 1 to 8 of 8

Thread: qwt 5 log scale..

  1. #1
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qwt 5 log scale..

    Hi,

    Is there a way to implement log scaling in qwt 5.x? small code pieces will be appreciated?

    Thanks,

  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: qwt 5 log scale..

    The bode example in the Qwt package has a logarithmic scale.

    HTH,
    Uwe

  3. #3
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwt 5 log scale..

    Thanks Uwe,

    Is there a way set the starting point to log scale. It starts at a very small number at default. But I want to start from 0. I couldnt find a suitable function..

    Thanks in advance..

  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: qwt 5 log scale..

    10 -> 1 -> 0.1 -> 0.01 -> ... -> 0.0: try to fill the missing steps and you will understand, why the scale doesn't start at 0.0.

    The engine for logarithmic scales accepts values in the range [1.0e-100, 1.0e100]. If you really need a scale starting from 0, you can derive your own "irregular" QwtScaleEngine, where you need to add some special rules for the range fom 0.0 to the value, where the regular scale starts.

    Another (much easier) option is to display a "0" as label for the first small value.

    Uwe

  5. #5
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwt 5 log scale..

    Quote Originally Posted by Uwe View Post
    10 -> 1 -> 0.1 -> 0.01 -> ... -> 0.0: try to fill the missing steps and you will understand, why the scale doesn't start at 0.0.

    The engine for logarithmic scales accepts values in the range [1.0e-100, 1.0e100]. If you really need a scale starting from 0, you can derive your own "irregular" QwtScaleEngine, where you need to add some special rules for the range fom 0.0 to the value, where the regular scale starts.

    Another (much easier) option is to display a "0" as label for the first small value.

    Uwe
    Hi Uwe,

    I have a plot which ranges from 0 to 1024. I want to change the scale of the axis. 10*log0 = 0 and 10*log1024 = 30.. But the scale starts from 1*e-3 and ranges to 3. That shows most of the data at the rightest side of the plot window. it looks bad. I just want to set a beginning and finishing point to that axis.

    What is the easiest way. I dont want to derive the class if i dont have to.

    Thanks in advance,

  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: qwt 5 log scale..

    Quote Originally Posted by halberdier83 View Post
    I dont want to derive the class if i dont have to.
    If you want a scale that is neither linear, nor log10, you have to implement its build rules as a QwtScaleEngine.
    If you think your special scale engine is of common interest, send your implementation to me.

    Uwe

  7. #7
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwt 5 log scale..

    Hi Uwe,

    Before i send my implementation, i want to be make sure about something. As you said, the default behaviour of logScaled plotting starts at e-100. I want to know that whether i can set a range to the axis. For example, i want to plot between 10, 100 in x-axis.

    Shortly, There is a setAxisScale method of QwtPlot. can i use this method after log scaled axis? i didnt try it yet. I just thought it. what do you think?

    Thanks..

  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: qwt 5 log scale..

    With QwtPlot::setAxisScale you assign a range and a step size for a specific axis scale. This is passed to YourScaleEngine::divideScale(...) to calculate ( align, divide) a valid scale ( min, max + tick positions ) from it.

    So the answer to your question is: it depends on your implementation of YourScaleEngine::divideScale.

    Uwe

Similar Threads

  1. QWT introduction
    By nitriles in forum Qwt
    Replies: 4
    Last Post: 28th September 2007, 10:48
  2. Qwt 5.0.2
    By Uwe in forum Qt-based Software
    Replies: 1
    Last Post: 20th September 2007, 18:21
  3. How to upgrade Qwt 5.0.1 to Qwt 5.0.2
    By luffy27 in forum Qwt
    Replies: 1
    Last Post: 15th July 2007, 19:55
  4. My own scale widget in Qwt
    By igrms in forum Qwt
    Replies: 7
    Last Post: 15th June 2006, 21:18
  5. use interesting QWT Library with QT3.X
    By raphaelf in forum Qwt
    Replies: 2
    Last Post: 23rd January 2006, 11:24

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.