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
Related
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.
I have a single set of value for X. Otherwise I have three set of Y values let it be y1,y3,y4.
Now, I am unable to plot X versus y1,y3,y4 in the same plot in GNUPLOT.
Can anyone help me out to solve this problem?
If you have your data in a file, assuming data.dat
X1 Y1 Y2 Y3
1 0.1 0.2 0.3
... ... ... ...
you can plot Y1, Y2 and Y3 versus X with
plot 'data.dat' using 1:2, '' u 1:3, '' u 1:4
u being the shortcut for using.
If all y values are of the same units, then one y axis would suffice. If not, you can plot x against up to 2 y-axes (here's how).
You use the 'axes' option to plot. Here is an example drawing 2 plots using the same X values:
set xrange [-4:4]
plot cos(x) axes x1y1 title "cos" with linespoints lt 1 pt 7 ps 0.0,\
sin(x) axes x1y2 title "sin" with linespoints lt 2 pt 8 ps 0.0
pause mouse any "Click the mouse or hit any key to terminate"
If you run that with gnuplot it should look like the following image
I am trying to draw 3d vectors from two different files to color the vectors in the first file with black and the others with red. Does anyone have an idea about how to achieve that?
This is a pretty easy one.
First set up your arrow styles:
set style arrow 1 linecolor rgb "red"
set style arrow 2 linecolor rgb "black"
Now make your plots:
splot 'datafile1' u 1:2:3:4:5:6 with vectors arrowstyle 1, \
'datafile2' u 1:2:3:4:5:6 with vectors arrowstyle 2
Of course, this assumes your datafiles are set up as:
x1 y1 z1 dx1 dy1 dz1
x2 y2 z2 dx2 dy2 dz2
...
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!