How to plot 3d vectors on 2-dimensional surface using Gnuplot? - plot

I am trying to reproduce a plot as in the attached image below.
In this picture, the position of the vectors is fixed at a specific position (let's say in a 10×10 grid), and the orientation of the vectors represents the magnitude of the x and y coordinate. In contrast, the color represents the magnitude of the z coordinate.
I need help with Gnuplot codes to plot a similar one.
enter data here
enter data here
Data points for referenceenter image description here.

The key of the solution is:
plot 'DATA.dat' with vectors head size 0.08,20,60 filled lc palette
you can play with the vector's head size parameters, borders, colors etc.

Related

How to plot an array over radial coordinates?

I have a matrix C (1000,1024), which consists of concentration values over the time t and the radius r. I have standardised the 1024 radius values from 0 to 1.
Now I want to display the concentration values over the radius at a certain time t, namely as a radial plot.
My idea would be to export an array from the matrix and display it radially. Here I assume that the concentration is constant over every angle of the circle and only changes outwards over the radius.
The filled circle should change colours depending on the concentration, like a 3D plot with colourbar.
How can I represent this with a code?
Many thanks in advance.

How to combine multiple 2D R plots into a single 3D plot

I am trying to stack multiple 2d plots into a single 3d plot in R.
For example, I want to try and put these plots
into a single 3d image. The z axis would be the biomass density, y axis be the size and the x axis be the time step (and then hopefully I could use a surface plot to join up all the lines). My aim is to try and show the wave travelling through the size over a long period of time instead of showing lots of images.
Does anyone know how to do this?

overlaid scatter plot where each data point has a different color and shape

I want to visualize a data transformation. My data is in 2 dimensions and the transformation is in 3 dimensions. I am interested in seeing how each data point is transformed in the higher dimensions. So overlaid two scatter plots using scatterplot3d package. The data which is in 2 dimensions has third coordinate assigned as 0 for plotting purposes. To keep track of each datapoint, I want to assign a unique color and shape in 2D and the transformed data value will have same color and shape in 3D. I was able to assign unique color but not shape since shapes are limited(my n=50). Any idea to make this visualization better ? Here is my reproducible example.
install.packages("scatterplot3d")
library(scatterplot3d)
set.seed(20)
# example
M<-cbind(a=runif(50),b=runif(50),c=rep(0,n))
N<-cbind(d=rnorm(50),e=rnorm(50),f=rnorm(50))
s3d<-scatterplot3d(N[,1],N[,2],N[,3],color=rainbow(n),type="p",pch=0
,xlab="x",ylab="y ",zlab="z")
s3d$points3d(M[,1],M[,2],M[,3],col=rainbow(n),type="p",pch=15)

Gnuplot "vector line"

I am trying to generate a plot which uses arrows as markers in Gnuplot. These arrows I want to turn in a specific angle which I know. So I have value triples of x1 ... xn, y1...yn, alpha1...alphan. Sorry, I wasn't able to include a pic from my hard drive to illustrate what I want to achieve.
Basically, for every (15th or so) x-y pair, the marker should be an arrow which uses a certain angle.
The measured data is tightly packed so I suppose I will have to define an increment between the markers. The length of the arrow can be the same all over.
I would appreciate your ideas.
Gnuplot has a plot mode with vectors that is what you want
Given that your file has the following format, x y angle and assuming that
your angle is in radians, you have to take into account that
with vectors requires 4 parameters, namely x y dx dy where dx
and dy are the projections of the lenght of the arrow.
this draws only the arrows, if you want a line you have to make
two passes on the data.
you want to draw an arrow for a data point over, say, 10 points.
That said, I'd proceed like this
dx(a) = 0.2*cos(a) # 0.2 is an arbitrary scaling factor
dy(a) = 0.2*sin(a)
# this draws the arrows
plot 'mydata.dat' every 10 using 1:2:(dx(a)):(dy(a)) with vectors
# this draws the line
plot 'mydata.dat'
You may want to use help plot to find the detailed explanation of all the parameters that you can apply to a with vectors plot.
Credits: An article on the gnuplotting site

Gnuplot: plot with circles of a defined radius

I know on gnuplot you can plot some data with circles as the plot points:
plot 'data.txt' using 1:2 ls 1 with circles
How do I then set the size of the circles? I want to plot several sets of data but with different size circles for each data set.
If you have a third column in your data, the third column specifies the size of the circles. In your case, you could have the third column have the same value for all the points in each data set. For example:
plot '-' with circles
1 1 0.2
e
will plot a circle at (1,1) with radius 0.2. Note that the radius is in the same units as the data. (The special file name '-' lets you input data directly; typing 'e' ends the input. Type help special at the gnuplot console for more info.)
You can look here for more ideas of how to use circles.
I used:
plot "file" using 1:2:($2*0+10) with circles
This will fake a the third column specifying the sizes - it is probably possible to write it simpler, but this worked for me.

Resources