Results 1 to 3 of 3

Thread: change manually the scale of y-axis

  1. #1
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default change manually the scale of y-axis

    Hi,
    I have qwt plot. I am trying to "remove the noise" from y-axis.

    For example, I have a data set where y-values vary between 0 and 10
    If the y-axis is autoscale(true) then the y-axis will be from 0 to 10
    Is it possible to make the y-axis scale to be from 0 to 100?
    Which qwt function changes this?

    I am planning to set a slider to control this function.

  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: change manually the scale of y-axis

    Doesn't QwtPlot::setAxisScale() do this? You probably have to set autoscale to false for that axis.

  3. #3
    Join Date
    Nov 2010
    Posts
    142
    Thanks
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: change manually the scale of y-axis

    yes, indeed, the QwtPlot::setAxisScale() was the right function to do this.
    I have connected a QSlider to "remove the noise", i.e. change the scale of the y-axis manually


    Qt Code:
    1. void my2dPlot::removeNoise(int noiseFactor)
    2. {
    3. double factorPerCentage = noiseFactor/10;
    4. myPlot->setAxisScale(QwtPlot::yLeft, (1-factorPerCentage)*0.4*meanOfYvalues , (1+factorPerCentage)*1.6*meanOfYvalues ,0);
    5. }
    To copy to clipboard, switch view to plain text mode 

    the only thing is that when I move the slider the whole transformation is a bit slow, but it definitely works.
    The other things is that I created the removeNoise(int) by empirical studies only, and when I first move the slider the graph jumps up a bit and then it changes smoothly. If you have any optimizing suggestions on that, please post.

Similar Threads

  1. Replies: 4
    Last Post: 16th January 2011, 10:32
  2. Replies: 8
    Last Post: 25th April 2010, 21:19
  3. Replies: 1
    Last Post: 19th May 2009, 11:14
  4. Axis with a probability scale
    By Lister in forum Qwt
    Replies: 1
    Last Post: 5th May 2009, 06:45
  5. 4 axis auto scale..
    By Vincenzo in forum Qwt
    Replies: 0
    Last Post: 22nd March 2009, 01:12

Tags for this Thread

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.