使用 gnuplot 绘制数百小时的数据
我正在尝试绘制来自模拟的数据,该模拟以(小时):(分钟):(秒)格式跟踪模拟时间,但不会将(小时)变成天 - 所以(小时)可以是数百个。然而,当 gnuplot 按时间绘制数据时(“设置 xdata 时间”),它只能在一张连续图中绘制最长 99 小时的数据;之后,它会循环回来,并在开始时开始过度绘制 100 多个小时(即使如此,也会做一些奇怪的事情)。有谁知道为什么会发生这种情况和/或如何解决它?
我还研究了以 3 个简单数字(整数)读取时间列的组成部分(这是每行数据的第三个字段,但不一定是行中的固定数量的字符),然后转换为实数,这恰好是时间的十进制版本(例如,107:45:00 -> 107.75),这对于绘图来说很好,但我一直无法弄清楚如何让 gnuplot也可以这样做。
欢迎任何其他想法。 (我宁愿不更改原始文件,由于每个文件的多个版本的额外复杂性,必须教其他人如何转换文件以及如何找出绘图不起作用,因为他们没有转换文件, ETC。)
I am trying to plot data from a simulation that tracks simulation time in (hours):(minutes):(seconds) format, but does not turn (hours) into days - so (hours) can be in the hundreds. When gnuplot plots data by time, however ("set xdata time"), it only plots up to 99 hours in one continuous plot; after that, it loops back around and starts overplotting hour 100+ near the beginning (and even then, does weird stuff). Does anyone know why this happens and/or how to get around it?
I also looked into reading the components of the time column (which is the 3rd field of data on each line, but not necessarily a fixed number of characters into the line) in as 3 simple numbers (integers), then converting to a real number, which happens to be a decimal version of the time (e.g., 107:45:00 -> 107.75), which would be fine for the plot, but I haven't been able to figure out how to get gnuplot to do that, either.
Any other ideas are welcome. (I would rather not alter the original file, due to the additional complexity of multiple versions of each file, having to teach others how to convert the file and how to figure out the plot didn't work because they didn't convert the file, etc.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MathGL(GPL 绘图库)的版本 2 具有可以根据需要设置的时间刻度(使用标准 strftime( ) 格式)。不过它现在处于测试版本——稳定版本应该会在 2011 年 10 月出现。
Version 2 of MathGL (GPL plotting library) have time ticks which can be set as you want (using standard strftime() format). However it is in beta version now -- stable version should appear at October 2011.