Is there any way to apply elliptical selection criteria for points found in a data file colums?
Hard to tell, without knowing what an "elliptical selection criterion" might mean, to you.
With set parametric I can plot the ellipse exactly over the data points, but how can I select to plot only those points which are within the ellipse, i.e. not to plot the outliers.
Find the implicit equation for that ellipse. It'll be something like
(x/a)**2 + (y/b)**2 = 1
Turn it into an implicit function:
f(x,y) = (x/a)**2 + (y/b)**2 - 1
Then use that to decide which points to plot:
plot 'data' using 1:(f($1,$2)<0 ? $2 : 0/0) with points
Quite clever, I didn't know that a function could be forced to read a data coumns in this way. This should work. However, I found my ellipse is parametrised in this form:
where c is the angle in which the ellipse is rotated
How can I implement that angle in your example?
I think I managed, (with transformation matrix):
f(x,y)=((x*cos(phi)+y*sin(phi))/a)**2 + ((x*cos(phi)-y*sin(phi))/b)**2
That's the right idea, but you have a bug in the resulting formula. The correct formula would have all 4 combinations of (x,y) * (cos,sin).
As a side note: if you know a thing or two about rotation matrices, it's not too hard to reach this form of the function:
f(x,y) = a11 * x*x + 2*a12*x*y + a22*y*y
which should evaluate somewhat faster, once you've found a11 to a22.
Yes, what I typed was not correct at all. I put all the combinations resulting from multiplication the vector with the rotation matrix in the gnuplot and it works for the data points!
I have now to see the correct transformation for the ellipses to draw, since they are in parametric mode. If I aply the same matrix I need to give +180 degree for the angle in which the elipse should be rotated. Then the data and the overploted data points match.
I'll try your last suggestion. Now the evaluation is a bit slow :)
> I need to give +180 degree for the angle in which the
> elipse should be rotated
That cannot possibly be the case --- what with an ellipse being identical to itself under such a rotation and all that ...
in parametric mode, the ellipse plot is quite unstable depending on the angle
You'll have to expand that description considerably before it can be addressed. But here's a hint that may prove useful:
help set angle
somehow the ellipses jump in 3 degrees, e.g. 31, 34, 37,
etc. work, but 32, 33,35, etc jump in different quadrant!
The set angle options doesnt fix the problem. When I say
> set angle degrees
it fix the problem with function jumping (it jumps in angles
different than 32, 35, 38, etc.), but now the ellipses are not being plotted
Both those effects you describe would be caused exactly by the various angles you use (specifically the parameter 't' of the parametric plot, and the rotation angle of the ellipse, \phi) being expressed not all in the same units.
set angles radians ; set trange [0:360]
will give you a very strange-looking ellipsoid, whereas
set angle degrees ; set trange [0:2*pi]
will give you only a very small piece of ellipse.
Thanks a lot for the advices!
I think that gnuplot's help database should give better
explanations elucidated with more examples. Especialy
evaluating functions with plot ... using. It is never
mentioned that I can refer a function within the plotting
conditions in the way you told me.
It is mentioned that you can put an expression in parentheses there, and what that means. The leap to guess that "expression" includes evaluating a function should be sort-of obvious --- and people for whom it's not should look up what "expression" means, which will tell them).