2017-09-25 78 views
0

这是太阳强度的数据记录器输出。gnuplot - X轴是一个时间值 - X11图是好的。如何使.png看起来类似

这里是什么样的数据看起来像一个摘录:

2017-09-24 12:44:48 1440 
2017-09-24 12:45:49 1434 
2017-09-24 12:46:50 1445 
2017-09-24 12:47:51 1446 
2017-09-24 12:48:52 1434 
2017-09-24 12:49:53 1431 

此图显示在一个xterm,看起来完美:

enter image description here

这个程序产生:

set title "OUTSIDE Light Intensity" 
set xlabel "Time" 
set ylabel "LUX" 
set yrange [0:*] 
set grid 
unset mouse 
unset log 
set key top left 
set timestamp 
set xdata time 
set timefmt '%H:%M:%S' 
set xtics format '%H:%M' 
set terminal x11 
set datafile missing "0.00" 
plot 1750 lw 1 lc rgb 'black' t "South", \ 
    "today.dat" using 2:($3*1.5) with lines lw 1 lc rgb 'red' t "Lux" 
pause 30 
reread 

按照

How can you watch gnuplot realtime data plots as a live graph, with automatic updates?

到目前为止,一切都很好。


即在cron运行的gnuplot的程序生成PNG文件等效。这是除了一个输出文件的终端设置和规格相同:

set output "plux.png" 
set terminal pngcairo 
plot 1750 lw 2 lc rgb 'black' t "South", \ 
    "today.dat" using 2:($3*1.5) with lines lw 2 lc rgb 'red' t "Lux" 

和输出看起来是这样的:

enter image description here

所以我的问题是:我如何控制.png的情节,所以它看起来像在X11终端相同?

似乎与字体有关。

这篇文章会谈到它:

gnuplot documentation: fonts

摘录:

的Gnuplot不提供任何自己的字体。它依赖于外部字体处理,不幸的是,从一种终端类型到另一种终端类型的细节不同。

+1

使用'wxt'和'pngcairo',https://stackoverflow.com/a/30334657/260421 – Christoph

+0

这很酷。但是,这将假设我总是有活动图表运行。我选择使用cron生成png文件,一直到午夜,当eod(一天结束时)python脚本运行时,将从各个Rpi/Nano传感器收集的所有内容按日期命名。这样,我可以继续进行野营旅行,它仍然可以自动运行,将其全部保存到磁盘以防止出现SD卡或闪存驱动器故障(其中有几个故障)。所以png世代节目与现场情节节目是分开的。 – SDsolar

回答

0

原来,当终端设置为png,像这样的答案是非常容易:

set term png font "arial,11" 

这样做时,输出文件看起来是这样的:

enter image description here

太好了。


但它回避的,因为它没有在OP提供的字体页提到在X11终端使用什么字体的问题。

所以在这里,我们去:gnuplot: X11_fonts

摘录:

最初启动时,默认字体是从X11资源 作为系统或用户.Xdefaults文件或命令集线。

示例: 的gnuplot *字体:lucidasans粗体-12

一个新的默认字体可以从内部使用

`set term x11 font "<fontspec>"` 

gnuplot的指定给X11驱动驱动器首先查询的X服务器给出了确切名称 的字体。



最后,Arial字体的终端为png是就好这些PNG文件。

它们用于蒙太奇的每一天,其中包括太阳能发电站的整个页面的绘图变量。

让他们彼此相似对于这个项目来说比让他们看起来像他们在屏幕上一样重要得多。

相关问题