如何为gnuplot创建数据文件? [英] How to create a data file for gnuplot?
问题描述
我正在尝试使用gnuplot制作图形.我指定了xrange
,yrange
和labels
,但是当我键入以下命令时:
I'm trying to make a graph with gnuplot. I specified my xrange
, yrange
, and labels
, but when I typed in the following command:
gnuplot>使用1:2线条绘制"data.txt"
gnuplot> plot "data.txt" using 1:2 with lines
gnuplot告诉我:
gnuplot tells me:
警告:跳过无法读取的文件"data.txt",图中没有数据.
warning: Skipping unreadable file "data.txt" No data in plot.
我不明白我的数据文件是如何不可读的.这是我的data.txt
的样子:
I don't understand how my data file is unreadable. This is what my data.txt
looks like:
X Y [I didn't enter X and Y into my text file]
10000 0.030
5000 0.02
1000 0.012
我知道我一定做错了-这是我第一次使用gnuplot.我尝试过进行Google搜索,以了解如何制作适当的data.txt文件.
I know I must be doing something wrong -- this is my first time using gnuplot. I tried doing a Google search on how to make a proper data.txt file turns up zilch.
我觉得在编程问答网站上问这听起来很奇怪,但是带有数据的典型文本文件应该是什么样?我不是计算机程序员,而只是一个本科生试图为她的生物化学课绘制图表.
I feel like this may sound strange to ask at a programming Q&A site, but what should a typical text file w/data look like? I'm no computer programmer, just an undergrad trying to plot a graph for her biochemistry class.
推荐答案
plot "data.txt" using 1:2 with lines
为我工作.您的数据文件中实际上是否有空行?这将导致一个空的情节.您可以看到没有数据的地块吗?就像情节x * x.如果没有,那么您的终端可能设置不正确.
works for me. Do you actually have blank lines in your data file? That will cause an empty plot. Can you see a plot without data? Like plot x*x. If not, then your terminal might not be set up correctly.
这篇关于如何为gnuplot创建数据文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!