QCustomPlot Discussion and Comments

Dear community,

Is it possible to make a 2d x/y plot, where y is not a function of x. For example to plot the pair of vectors x,y where:

x = cos(0...2*pi)

and

y = sin(0...2*pi)

this should show a circle of radius 1.

When I test this a line plot, I get a full area instead of a circle.

As a workaround, I can use a scatter plot and have the dots very close to each other, but this is just a workaround and it does not work well with zooming as at some point the dots get visible. Is it possible to make a true line plot that simply connects the successive points in the vector pairs (x,y)


Kind regards,
Jan

Hi Jan,
if I understood your problem right, I guess, you should use a QCPCurve.
With a QCPGraph it is not possible to plot two y points with the same x value.
See here a little example from the QCustomplot examples: setupParametricCurveDemo

QCPCurve *fermatSpiral1 = new QCPCurve(customPlot->xAxis, customPlot->yAxis);
customPlot->addPlottable(fermatSpiral1);
for (int i=0; i<pointCount; ++i)
{
double phi = (i/(double)(pointCount-1))*8*M_PI;
x1 = sqrt(phi)*cos(phi);
y1 = sqrt(phi)*sin(phi);
}
// pass the data to the curves:
fermatSpiral1->setData(x1, y1);

Kond regards,
Bennj