gnuplot矢量箭头长度和流线 [英] gnuplot vector arrow length and streamlines

查看:239
本文介绍了gnuplot矢量箭头长度和流线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经要求关于矢量场在这里.现在,我想了解更多有关它的信息.

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?

并且仍然无法在gnuplot中绘制流线吗?如果可能的话,我该怎么办?

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'

更新

感谢@theozh,我有了想要的东西.我想分享我的结果,因为它可能对其他人有用. 现在,我使用这些说明来绘制矢量场.

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

推荐答案

大约相同的长度:只需对向量进行归一化即可.

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).

使用示例代码:

### 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

您将获得:

这篇关于gnuplot矢量箭头长度和流线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆