Results 1 to 2 of 2

Thread: Problem in plotting curve

  1. #1
    Join Date
    Jul 2011
    Posts
    12
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problem in plotting curve

    Hi,
    I have to plot some ponits in the form of red ecllipse whose x and y cordinate is given as
    double xval[]= {4.9072,5.3706,5.1998,5.9066,4.3621,3.8183,3.5040, 0.9344,2.1548,2.8119};
    double yval[]= {1.8761,7.0344,2.9916,3.3538,44.7207,9.3471,42.343 7,718.3273,18.1954,17.8637};


    for this plotting I have used QWT_Plot_Marker and setx,y value that and i was able to plot the ecllipse point but since there was 10 points so i had to create 10 marker sbut in my real application, ponit can be more than 100 thounsand so i wont feel this the appropriate way for plotting


    Another way to plot ponitsis to use plot curve with symbol ecllipse and style no curve but in this case if i am using setRawSamples() method then plotting is not done below is the code


    setAxisTitle(QwtPlot::yLeft, "Normalize Energy");
    setAxisScale(QwtPlot::yLeft, 0,100,10);
    setAxisTitle(QwtPlot::xBottom, "Modes");
    setAxisScale(QwtPlot::xBottom, 0.0, 6.0,0.5);


    QwtPlotGrid *grid = new QwtPlotGrid;
    grid->enableX(true);
    grid->enableY(true);
    grid->enableXMin(false);
    grid->enableYMin(false);
    grid->setMajPen(QPen(Qt::black, 0, Qt:otLine));
    grid->attach(this);

    // curve
    d_curves.setSymbol(new QwtSymbol(QwtSymbol::Ellipse, Qt::red,
    QPen(Qt::red), QSize(20, 10) ) );
    d_curves.setPen(QColor(Qt::red));
    d_curves.setStyle(QwtPlotCurve::NoCurve);

    //attach data

    d_curves.setRawSamples(xval, yval, 10);

    //atach curve to plot
    d_curves->attach(this);

    replot();


    Please let me know why potting of ecllipse using curve is not being done what is wrong with my code

    If I am using QWT plot marker in this case whether it is right approch or not?

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

    Default Re: Problem in plotting curve

    Use QwtPlotCurve but not setRawSamples when your samples are from the stack.

    When you are planning to have curves with more than 100000 points try to understand what QwtSeriesData is about. Also check the archive of the forum for threads about how to implement different levels of detail,

    Uwe

  3. The following 2 users say thank you to Uwe for this useful post:

    hzymlx (5th August 2011), johnMick (5th August 2011)

Similar Threads

  1. Problem in plotting 3D plot using QWT
    By johnMick in forum Newbie
    Replies: 1
    Last Post: 15th July 2011, 11:19
  2. Replies: 1
    Last Post: 29th April 2011, 12:26
  3. Replies: 4
    Last Post: 6th October 2010, 13:29
  4. Replies: 4
    Last Post: 29th April 2010, 06:11
  5. Plotting part of a curve
    By viridis in forum Qwt
    Replies: 6
    Last Post: 21st July 2008, 08: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.