Results 1 to 2 of 2

Thread: More than one errorbars in a plot??? (Qwt 6.0.1)

  1. #1
    Join Date
    Jun 2008
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default More than one errorbars in a plot??? (Qwt 6.0.1)

    Hi folks!

    I am trying to make a plot where I can show more curves that include errorbars (each has its own one).
    I started at the friedberg example and made a few adjustments in the "Plot::Plot(...)" constructor.

    I changed the data with something simple just to see what will happen... Here is the corresponding code:

    Qt Code:
    1. ...
    2. const int numElements = 5;
    3. QVector<QPointF> curve1( numElements );
    4. QVector<QwtIntervalSample> errorbar1( numElements );
    5. QVector<QPointF> curve2( numElements );
    6. QVector<QwtIntervalSample> errorbar2( numElements );
    7.  
    8. for ( int i = 0; i < numElements; i++ )
    9. {
    10. curve1[i] = QPointF( double( i ), double( pow(i,3) ) );
    11. errorbar1[i] = QwtIntervalSample( double( i ),
    12. QwtInterval( pow(i,3)-i, pow(i,3)+i ));
    13.  
    14. curve2[i] = QPointF( double( 2*i ), double( pow(i,3) ) );
    15. errorbar2[i] = QwtIntervalSample( double( 2*i ),
    16. QwtInterval( pow(i,3)-i, pow(i,3)+i ));
    17. }
    18.  
    19. insertCurve( "Curve 1", curve1, Qt::darkRed );
    20. insertErrorBars( "Error-Bars 1", errorbar1, Qt::red );
    21. insertCurve( "Curve 2", curve2, Qt::darkGreen );
    22. insertErrorBars( "Error-Bars 2", errorbar2, Qt::green );
    23. ...
    To copy to clipboard, switch view to plain text mode 

    The problem is that with this way, I can't see both error bars. Only the last one is shown in the plot. Same applies if I extend to 3 curves/error bars and so on...
    Only the last one is visible. More curves work. But not the error bars. So why are the other bars not there?
    Why does it work with the function insertCurve() and not with insertErrorBars()?
    And in the legend, on the right (see picture errorbars.png) the symbol for the first bar also doesn't appear.

    The general problem is that i can't associate a QwtIntervalSample() to a curve. I can only associate the interval to a x- or y-value.
    But if i want to plot more than one curves, then how can QwtIntervalSample() know which x- or y-value I mean???
    The curves may use somewhere the same values...

    Is it possible to do something like that with this version of Qwt (6.0.1) ???
    Or can u only have one "error bar" in a plot atm?

    Thanks for some help on that one!
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: More than one errorbars in a plot??? (Qwt 6.0.1)

    Quote Originally Posted by freeman_w View Post
    Why does it work with the function insertCurve() and not with insertErrorBars()?
    Both methods are part of the friedberg example not the Qwt library - check the code and you will find the answer yourself.

    Of course you can have as many interval curves as you want in the same plot.

    Uwe

Similar Threads

  1. Put plot axis out of the plot
    By KosyakOFF in forum Qwt
    Replies: 7
    Last Post: 21st June 2013, 13:36
  2. qwt plot
    By kamalasan in forum Qwt
    Replies: 6
    Last Post: 18th June 2011, 16:24
  3. how to plot graph using qwt ?
    By sunitverma04 in forum Newbie
    Replies: 2
    Last Post: 13th April 2010, 13:50
  4. how to plot inequalities with QWT?
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 22nd February 2010, 12:41
  5. Replies: 7
    Last Post: 22nd September 2008, 22:05

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.