问题
I have already asked about vector fields in here. Now I want to know a bit more about it.
How can I make it so that each arrow has the same fixed length and define the magnitude of the value by color?
And is it still not possible to plot streamlines in gnuplot? If possible, how can I do that?
For now I have this and need to upgrade it.
set term pngcairo
set title 'Navier-Stokes Equation'
set terminal png size 1280,720
set output 'vec.png'
plot 'vec' u 1:2:($3/$5):($4/$5) w vec t 'Vector Field'
UPDATE
Thanks to @theozh I've got what I wanted. I want to share my result as it could be useful for someone else. Now I use these instructions to plot my vector field.
reset session
set size square
set palette rgb 33, 15, 10
set term pngcairo
set title 'Navier-Stokes Equation'
set terminal png size 1280, 720
set output 'vec.png'
plot 'vec.dat' u 1:2:(0.08*$3):(0.08*$4):(sqrt($3**2+$4**2)) w vec lw 2 lc palette notitle
回答1:
About the same length: simply normalize your vectors.
About the color: you can add a "column" and the end. The last column will define the color according to a palette.
I don't know about streamlines (what exactly they are and how to possibly realize them).
With the example code:
### plot with vectors
reset session
set size square
set samples 25
set palette rgb 33,13,10
Scaling = 0.5
plot [-5:5] '++' u 1:2:\
(Scaling*$1/sqrt($1**2+$2**2)):(Scaling*$2/sqrt($1**2+$2**2)): \
(sqrt($1**2+$2**2)) with vectors lc palette notitle
### end of code
You'll get:
来源:https://stackoverflow.com/questions/55057828/gnuplot-vector-arrow-length-and-streamlines