Gnuplotting changing axis basis - gnuplot

i've got a data set that is of a vector f(x,y,z). Formatted as fx fy fz x y. This data set is of a crystal lattice and it's associated reciprocal lattice. The coordinates x y are in a non orthogonal basis. Such that x and y are unit vectors x=(1,0) y=(0.5,sqrt(3)/2). I'm trying to plot a set of 3 heatmaps one for each component of f. My issue is that I can seem to change the x and y axis such that they are the unit vectors above. Is there a way to make non-orthogonal/perpendicular axes in gnuplot? If not does anyone have any ideas on how to represent this data set?
Thanks in advance

What you can do is not change the axes, but apply a change of variable from your columns 4 and 5 to the cartesian coordinates x,y:
ex_x=1; ex_y=0
ey_x=0.5; ey_y=sqrt(3)/2
splot "file.dat" u (ex_x*$4+ey_x*$5):(ey_y*$4,ey_y*$5):1 with pm3d

Related

Is it possible to get the y value of a cubic bezier curve based on the x value?

I am working with bezier curves to represent wave data for audio. I want to then sample the wave at an x coordinate and get the y coordinate so that I can then convert it to PCM data. Now since bezier curve are represented with a parametric equation this could pose problems as there could be multiple y values an x value, but with the curves I would sampling I can guarantee that they meet the criteria of a function only they are still represented para-metrically. So my question is, is there a way to directly sample the y value based on an x value? If not what would be the best way to go about doing this? My best idea right now is move along the curve until I reach the desired x-value and then use that y value, but this feels slow and inefficient. Thank you.
Yes, it is possible but it is somewhat complex. You must solve for t at a given x and then calculate y from t. This can be approximated with the newton-raphson method. This link does a much better job explaining how to implement it: http://greweb.me/2012/02/bezier-curve-based-easing-functions-from-concept-to-implementation/
Another option is to use a an explicit bezier curve, not a parametric bezier curve. Explicit meaning that y is a function of x (i.e. y=f(x)). As opposed to a parametric equation where both x and y are functions of t (i.e. x=f(t) and y=f(t)). As long as the x values of the control points are evenly spaced the curve is explicit and you can assume that x=t.
EDIT: I should point out that my statement of equally spaced x coordinates means x=t is an over-simplification. That would be true if the x coordinates were evenly spaced between 0 and 1. Otherwise you need to convert the x coordinate to a value between 0 and 1. For example if the x coordinates were evenly spaced and located at 3,4,5,6 then t = (x - 3) / (6 - 3).

How to use dgrid3d with X and Y points to plot an intensity map

I have a file with X Y data points (> 10^4)
12.399999999999999 3.7333333333333334
22.13333333333334 34.93333333333333
13.600000000000001 10.133333333333333
94.26666666666667 26.
25.333333333333336 8.666666666666666
52. 38.
25.33333333333333 51.733333333333334
24.799999999999997 37.333333333333336
77.33333333333333 5.466666666666667
13.2 7.733333333333333
33.46666666666667 4.666666666666667
33.86666666666666 46.
52.8 3.466666666666667
24.400000000000002 20.933333333333334
54.53333333333334 27.6
121.73333333333335 30.133333333333333
103.73333333333333 13.466666666666667
47.599999999999994 5.333333333333333
...........
(positive and non-gridded), which I would like to plot with Gnuplot.
I have been looking different posts and examples, and they provide a function for the intensity or directly the Z values corresponding to the intensity, or they use an array of values indicating pixels or squared zones of an image.
I would like to ask if there is a way to plot an intensity map plot providing only the X and Y points. Also, I would like to know if it is possible to indicate the range to plot and the granularity (the bin size or the interpolation order).
Thank you very much for the help
EDIT (based on Comments)
I have tried set size square
set autoscale fix
unset key
set view map
set xrange [0:200]
set yrange [0:200]
set dgrid3d 10,10,4
splot "data.dat" w pm3d
Gnuplot tells me that I need a third column with the weights.
I have no third column in my dataset, just the X and Y values.
How could I correctly use dgrid3d, and plot an intensity map or frequency map of my points?
Note: My Gnuplot is version 5.2, and there is an option bin which can be used to bin x values, but I do not know if it can bin 2D points too

Rotating a plot in gnuplot

1-How can I rotate my plot so y would be the new x axis and vice versa?
2- Change the maximum value of y axis from 60 to 100.
The plot is created by this script in the terminal :
set palette grey
plot 'color_map.dat' matrix with image
You can exchange the x and y axes with the using modifier. (Just like for ordinary plots, except that for matrix data, columns 1 and 2 are not in your data file, but are inferred.)
plot 'color_map.dat' matrix using 2:1:3 with image
If you actually just want to change the maximum value on the y (new x) axis, you would use set xrange[:100]. But it sounds like you might actually want to scale the data itself, in which case you could use
plot 'color_map.dat' matrix using ($2/60.*100):1:3 with image
Try help plot matrix for more details.

Second y axis displaced

I am quite new to gnuplot. And I've got problem with secondary y axis. When I try to plot two curves into one graph with two different y axis, the second one is moved down a little bit. I mean that if you draw a straight line parallel to the x axis at y1 = 0, you get different y2 values. I want both y axes to start at the same point y1=0 ~ y2=0.
Here is the picture better describing my problem:

GNU plot on non uniform data in x axis with fix interval

9 1782.091513,
24 4731.999530,
36 6377.046661,
80 9377.983901,
108 9158.024005,
210 4314.926970,
540 56799.564,
2000 67908.2343,
7000 45345.657,
12000 34234.3624,
Plotting this giving me a graph on which i am not able to see the small values. I want to fix the interval b/w each value of x axis. So that graph will be visible on full table.
You can set your axes to be logarithmic:
set logscale x
set logscale y
Logscale is probably what you actually want here as pointed out by choroba. A second (less standard) way to plot this is to use the values in the first column as the xticlabels.
plot 'yourdatafile' u 2:xticlabels(1)
This will result in a plot where the values are equally spaced on the x-axis, labelled with the corresponding x positions from the datafile.

Resources