Gnuplot:如何在曲面图中删除平行于 x 轴的网格线 [英] Gnuplot: How to remove mesh line parallel to x axis in surface plot

查看:28
本文介绍了Gnuplot:如何在曲面图中删除平行于 x 轴的网格线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从数据文件绘制曲面.我想删除平行于 x 轴的网格线.

I am plotting a surface from a data file. I want to remove the mesh line parallel to x axis.

这是我的代码:

set xlabel 'x';
set ylabel 'y';
splot "-" using 1:2:3 notitle w l;
1 1.0 0.998
1 2.0 0.998
1 3.0 0.998
1 4.0 0.998
1 5.0 0.997
1 6.0 0.997
1 7.0 0.997
1 8.0 0.997
1 9.0 0.997
1 10.0 0.997

2 1.0 0.998
2 2.0 0.997
2 3.0 0.996
2 4.0 0.995
2 5.0 0.995
2 6.0 0.995
2 7.0 0.995
2 8.0 0.994
2 9.0 0.989
2 10.0 0.987

3 1.0 0.997
3 2.0 0.997
3 3.0 0.997
3 4.0 0.997
3 5.0 0.997
3 6.0 0.997
3 7.0 0.996
3 8.0 0.996
3 9.0 0.995
3 10.0 0.994

4 1.0 0.997
4 2.0 0.996
4 3.0 0.993
4 4.0 0.99
4 5.0 0.986
4 6.0 0.982
4 7.0 0.977
4 8.0 0.974
4 9.0 0.966
4 10.0 0.959
e

这将产生:

我需要的是:

第二个图是加了一条假数据线:

The second figure is produced by adding a dummy data line:

2 11.0 0.987

但是,我正在根据数据文件的加载进行绘图.我无法修改每个数据文件以添加虚拟数据行.不加虚拟数据线可以生成第二个图形吗?

However, I am plotting from load of data files. I can not modify each data file to add a dummy data line. Is it possible by not adding dummy data line to produce the second figure?

推荐答案

最简单的方法是用两个空行替换每个空行.然后每个 x 值都有一个数据块.并且不同块中的点不相互连接:

The easiest way is to replace every empty line with two empty lines. Then you have one data block for every x-value. And points in different blocks aren't connected with each other:

文件 data.txt 包含:

1 1.0 0.998
1 2.0 0.998
1 3.0 0.998
1 4.0 0.998
1 5.0 0.997
1 6.0 0.997
1 7.0 0.997
1 8.0 0.997
1 9.0 0.997
1 10.0 0.997

2 1.0 0.998
2 2.0 0.997
2 3.0 0.996
2 4.0 0.995
2 5.0 0.995
2 6.0 0.995
2 7.0 0.995
2 8.0 0.994
2 9.0 0.989
2 10.0 0.987

3 1.0 0.997
3 2.0 0.997
3 3.0 0.997
3 4.0 0.997
3 5.0 0.997
3 6.0 0.997
3 7.0 0.996
3 8.0 0.996
3 9.0 0.995
3 10.0 0.994

4 1.0 0.997
4 2.0 0.996
4 3.0 0.993
4 4.0 0.99
4 5.0 0.986
4 6.0 0.982
4 7.0 0.977
4 8.0 0.974
4 9.0 0.966
4 10.0 0.959

现在用

splot '< sed "s/^$/
/g" data.txt' w l

得到

如果您不能使用 sed,则必须使用类似于 绘图矩阵中所示的方法线条 gnuplot:

If you cannot use sed, you must use an approach similar to the one shown in plot matrix with lines gnuplot:

stats 'data.txt' nooutput
splot for [i=0:STATS_blank] 'data.txt' every :::i::i lt 1 w l

这篇关于Gnuplot:如何在曲面图中删除平行于 x 轴的网格线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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