Results 1 to 4 of 4

Thread: Synchronizing Y-axis scaling when zoomed with QwtPlotZoomer for two curves

  1. #1
    Join Date
    Nov 2010
    Posts
    122
    Thanks
    62
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Cool Synchronizing Y-axis scaling when zoomed with QwtPlotZoomer for two curves

    I have noticed an interesting behavior when using the
    QwtPlotZoomer tool on a plot which consists of two
    curves. The curves, as shown in the attached screenshot,
    are a cosine and sin wave. Autoscaling is enabled for
    both Y-axis. The values range from 1 to -1 for each curve.

    When the zoom rectangle is used to zoom in on the curve,
    the Y-axis do not scale in the same manner, which looses
    the fidelity and alignment between them on the plot.
    This is shown as ChartZoom.jpg as an attachment.

    How can I get similar behavior from the two axis when
    using the QwtPlotZoomer class when essentially the same
    autorange value is defined for both Y-axis (here the
    range is -1 to 1)?
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Synchronizing Y-axis scaling when zoomed with QwtPlotZoomer for two curves

    After having used QwtPlotZoomer, u have defined scales. Hence autoscaling is switched off. U need to switch on autoscaling again by setAutoScale(yLeft) etc if u want to enable autoscaling.
    HTH

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

    bob2oneil (18th May 2011)

  4. #3
    Join Date
    Nov 2010
    Posts
    122
    Thanks
    62
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Synchronizing Y-axis scaling when zoomed with QwtPlotZoomer for two curves

    This is not so much one of autoscaling being turned off, as one where the zooming is not consistent across the Y-axis, when in fact both axes are set up to autoscale, and since I am using a Cosine and Sin to drive the data, the range
    of both axes is the same. I was expecting with identical Y ranges, that the zooming would be consistent. However, what happens, as you can see in the screenshot, is that the is some skew between the two Y axes, the net result being
    that the relationship between to two curves is no longer value. You can see in the screenshot that the purple curve, the Sin lays above the highest peak of the Cos, the yellow curve. Both should have a positive high value of 1. The
    reason is obvious from inspection of the Y ranges, wherein they are not synchronized and scale differently as a result of the zoom rectangle. This analysis is performed AFTER say 15 seconds of data, and the data is not changing at the time the zoom rectangle is used, and the autoscaling of the axes has reached its terminal conditions.

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

    Default Re: Synchronizing Y-axis scaling when zoomed with QwtPlotZoomer for two curves

    A zoomer controls only one x and one y axis. If you want to zoom 2 y axis you need a second zoomer ( of course without tracker and rubber band ). See the bode example.

    Uwe

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

    bob2oneil (18th May 2011)

Similar Threads

  1. Replies: 3
    Last Post: 18th May 2011, 16:56
  2. Y axis not auto scaling
    By pkj in forum Qwt
    Replies: 0
    Last Post: 12th May 2011, 16:05
  3. Replies: 1
    Last Post: 2nd May 2010, 18:27
  4. Replies: 10
    Last Post: 18th September 2008, 15:14
  5. Scaling Painter without scaling the coordinate sytem
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 7th January 2008, 21:30

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.