使用GNUplot按行绘制.csv数据 [英] Plotting .csv data by row with GNUplot

查看:38
本文介绍了使用GNUplot按行绘制.csv数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个仅包含数字值的.csv文件.我想将每一行绘制为单独的图,并使用y轴上的值与值的位置作为x值.即:

I have a .csv-file that contains only numeric Values. I want to plot each row as a seperate Plot and use the Values on the y-Axis versus the position of the Value as x-Value. I.e.:

10,2,5,69,7,8,6

有什么方法可以在不外部重新排列数据的情况下进行操作?

Any way to do this without externally rearranging the data?

推荐答案

这是一组非常晦涩的命令,可以满足您的要求.我会毫不犹豫地推荐它,因为它对于混淆的意义不明显,并且对于空字段或缺少数据而言是脆弱的.需要gnuplot版本5.

Here is a very obscure set of commands that does what you ask. I hesitate to recommend it because it is non-obvious to the point of being obfuscated and it is fragile with respect to empty fields or missing data. Requires gnuplot version 5.

# Specify that this is a *.csv file
set datafile separator ","
# This command will plot value as a function of column for row n
plot 'rowdata' matrix using 1:0 every :::n::n with lp
# This command will do the same for each row in the file
plot for [col=1:*] 'rowdata' matrix using 1:0 every :::col::col with lp

这篇关于使用GNUplot按行绘制.csv数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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