PDA

View Full Version : Problem in plotting curve



johnMick
5th August 2011, 10:02
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::DotLine));
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?

Uwe
5th August 2011, 10:09
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