I have a grid of x,y points that are (as far as gnuplot is concerned) unstructured. I would like to plot a variable on that grid using gnuplot's pm3d. Currently, I'm constructing a delaunay tesselation and writing each triangle into the datafile as a separate dataset. for example, the datafile looks something like this:
#triangle 1
x1 y1 c1
x2 y2 c2
x3 y3 c3
x3 y3 <c1+c2+c3>/3.
#triangle 2
x1 y1 c1
x2 y2 c2
x3 y3 c3
x3 y3 <c1+c2+c3>/3.
#triangle 3
...
This seems to work Ok, but I was wondering if there a better way to accomplish this? (if it matters, I'm using Python+Delny interface to construct the delaunay tesselation)
Apparently the above solution is as good as I'm going to find. If you have a better way to plot unstructured data in gnuplot, other than dgrid3d, I'd love to hear it!
Related
I have 4 points. If I were to draw lines from every point to every other point, I will get 4 exterior lines and 2 lines crossing in the middle. What I'm trying to identify is the point at which the 2 crossing lines intersect. All I know is the coordinates of each of the 4 points (x0, y0, x1, y1, x2, y2, x3, y3).
Is there a simple solution to this that I'm missing?
Edit: Edit: Fixed. I was missing the two formulas: x = x1 + ua (x2 - x1) and
y = y1 + ua (y2 - y1).
There is nothing special in intersection of quadrilateral diagonals. Just use any approach for intersection of two line segments. Wiki (note that perhaps point order differs from yours)
I am trying to produce a colour contour plot (the coloured projection of a surface or a "map") from a file that has the following format:
y1 z1 #first block
y1 z2
y1 z3
....
y1 zn
<blank line>
y2 z1 #second block
y2 z2
y2 z3
....
y2 zn
<blank line>
y3 z1
y3 z2
y3 z3
....
y3 zn
etc
Hence if you took the second column of each datablock, you turned it into a line (instead of column) and you stuck them one on top of the other, you would get your traditional matrix plot.
Is there a way to plot this thing (or to take the z columns, make them into lines, stack them and plot them)?
I have been looking into splot, set view map.
So your xvalues are uniformly distributed? Do something like this
set view map
splot "data" u (column(-1)):($1):($2) w pm3d
If you can define your xvalues, use
xval(x)=1.+0.5*x #or whatever
splot "data" u (xval(column(-1))):($1):($2) w pm3d
I have two curves; Curve 1 (x1, y1), Curve 2 (x2, y2) in which the value of x2 is equal z times of the value of x1 (e.g., x2 = 1.5 * x1); y axis value is not change. I would like to plot two curves in the same proportion of the x axis value, i.e. i want to change the proportion of x2 value to the x1 value in order to same the peaks of two curves above.
I had tried to find a lot of supports in internet but it has not any suitable result.
Many thanks for your helps.
I just feel pretty stupid, because I can't find a solution for my problem. Maybe someone can help me please:
I have the values Y1 and X1 (where X1 is always bigger than Y1). If I want to draw a curve between the two points y1, x1 based on a circle (no ellipse), how to find out the y2 value which would be the center of the cycle and the radius (r)? I think the circle's radius would get bigger and it's center would move down on the y-axis the greater x1 is (if Y1 doesn't change), right?
This is simply a math question.
First of all you should find the middle of the two points Y1 (0,10) and X1 (20,0)
which is (10,5).
Now we should determine the slope of the line which is perpendicular on the line between X1 and Y1. That slope is equal to 20/10=2
Thus the equation of that line will become y-5=2*(x-10) and thus y=2x-15
To find the coordinates of Y2 we have to find the point where the x value is 0. that is on y=-15. Thus the Y2 coordinate is (0,-15).
You can find the value for Y2 in the same way for other values than 20 and 10.
With GNU Plot, I normally process x, y, z data in three separate columns:
x1, y1, z1
x2, y1, z2
...
...
xn, yn, zn
and I used splot 'filename.ext' with lines to quickly get the a 3D plot
Due to our new system requirements, we have to store data in the following form:
x1
y1
z1
x2
y2
z2
.
.
xn
yn
zn
I already written a simple code in C# to transform our results into 3 columns for easy viewing in GNU Plot.
My question is, if the data is now only a one dimensional array, is there a way to plot this in GNU Plot directly without having my program to re-saved our results as a 3 columns results?
Thank you.
Regards,
ikel
Additional info: I am running on Win7, 64 bit, and using the Win binaries of GNU Plot. Apparently, I don't have paste, sed and popen (see discussion below).
I don't know how to make Gnuplot interpret the input as groups of three, but if your version of Gnuplot supports popen, you can join the lines on the fly with e.g. paste or sed:
splot '< paste - - - < filename.ext' with lines
Or:
splot '< sed "N; N; s/\n/ /g" filename.ext' with lines