简体   繁体   English

gnuplot 散点图 plot 在第 3 列中选择值范围的数据

[英]gnuplot scatter plot selecting data on range of value in 3rd Column

In a Windows 7 environment, I need to do a gnuplot scatter plot of 2 columns selecting data based on a range of values in a 3rd column.在 Windows 7 环境中,我需要执行 2 列的 gnuplot 散点图 plot,根据第 3 列中的一系列值选择数据。 I know how to do it by creating separate data files for each range, but is it possible to do it by filtering on the data value in a 3rd column without awk Thanks我知道如何通过为每个范围创建单独的数据文件来做到这一点,但是是否可以通过在没有 awk 的情况下过滤第 3 列中的数据值来做到这一点谢谢

plot "<awk '{if($3>=11 && $3<=19) print $0}' plot.dat " using 1:2 with points warning: Skipping data file with no valid points plot "<awk '{if($3>=11 && $3<=19) print $0}' plot.dat " using 1:2 with points 警告:跳过没有有效点的数据文件

I Presume the error is because I don't have awk in windows7 envirenment我假设错误是因为我在 windows7 环境中没有 awk

There are (should be) many examples of filtering data with gnuplot here on StackOverflow, however, mostly combined with another issue. StackOverflow 上有(应该有)很多使用 gnuplot 过滤数据的示例,但是,大多数与另一个问题结合在一起。 So, whenever I'm trying to search for a really good and clear example, it takes more time for searching than to simply write down the line.所以,每当我试图搜索一个真正好的和清晰的例子时,搜索比简单地写下这行要花费更多的时间。 You definitely don't need awk!你绝对不需要awk!

Attention: Filtered data will not be connected in a line plot. So, in case you want to plot connected filtered lines, eg with lines or with linespoints you need to prepend an extra line.注意:过滤后的数据不会连接到 plot 行。因此,如果您想要 plot连接过滤后的行,例如with lineswith linespoints线点,您需要在前面加上额外的行。 I assume you have gnuplot>=5.0.我假设你有 gnuplot>=5.0。 For older gnuplot versions you can check this workaround .对于较旧的 gnuplot 版本,您可以查看此解决方法

The following will plot column 1 versus column 2, but only if column 3 is in the range 11 to 19.以下是 plot 第 1 列与第 2 列的比较,但前提是第 3 列在 11 到 19 的范围内。

set datafile missing NaN
plot "myData.dat" u 1:($3>=11 && $3<=19 ? $2: NaN) w linespoints

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM