#!/bin/sh
file=$1
field=$2
yfield=`cat $file |awk '{if(NR==1) print $'''$field'''}'`
title="`basename $file`
if [ $# -eq 2 ]
then
echo "
set terminal pngcairo lw 2
set title \"$title\"
set xlabel \"$yfield\"
set ylabel \"$yfield\"
set output "./output/$title-$yfield.png"
plot \"$file\" using $field w lp pt 7 title \"$yfield\"
set output
set terminal wxt
" | gnuplot
fi
自动化测试可去掉节点数量
csv文件需要替换【逗号为空格】
csv要复制临时文件修改并画图
#!/bin/sh
file=$1
xfield=`cat $file |awk -F, '{if(NR==1) print $4,$5}'`
title=`basename $file`
if [ $# -eq 1 ]
then
echo "
set terminal png truecolor size 750,550
set title \"$title\"
set xlabel \"$xfield\"
set autoscale
set xdata time
set timefmt "\"%H:%M:%S\""
set format x '"%H:%M:%S"'
set autoscale y
set xrange ['"02:00:00"':'"02:00:31"']
set output './output/$title.png'
set grid
plot \"$file\" using 1:4 w lp pt 5,'' using 1:5 w lp pt 7
set output
set terminal wxt
" | gnuplot
fi
历史数据:
#!/bin/sh
file=$1
xfield=`cat $file |awk -F, '{if(NR==1) print $4,$5}'`
title=`basename $file`
if [ $# -eq 1 ]
then
echo "
set terminal pngcairo lw 2
set title \"$title\"
set xlabel \"$xfield\"
set timefmt "\"%H:%M:%S\""
set format x '"%H:%M:%S"'
set autoscale y
set xrange ['"02:00:00"':'"02:00:31"']
set output './output/$title.png'
plot \"$file\" using 1:4 w lp pt 5,'' using 1:5 w lp pt 7
set output
set terminal wxt
" | gnuplot
fi
set terminal png truecolor size 750,550 #指定输出成png图片,且图片大小为550×250,需要ligpng支持,采用默认颜色设定
set output "test.png" #指定输出png图片的文件名
set autoscale #轴向标记自动控制
set xdata time #X轴数据格式为时间
set timefmt "%H:%M" #时间输入格式为"小时:分钟"
set format x "%H:%M" #x轴时间输出格式
set style data lines #数据显示方式为连线
set xlabel "Time" #X轴标题
set ylabel "Load %" #Y轴标题
# set title "image.tuku.china.com flow" #图片标题
set grid #显示网格
plot "data.txt" using 1:2 title "Average value" #从test.log文件中读取第一列和第二列作为X轴和Y轴数据,示例名"log_flow"
#!/bin/sh
file=$1
xfield=`cat $file |awk -F, '{if(NR==1) print $4,$5}'`
title=`basename $file`
if [ $# -eq 1 ]
then
echo "
set terminal png truecolor size 750,550
set title \"$title\"
set xlabel \"$xfield\"
set autoscale
set xdata time
set timefmt "\"%H:%M:%S\""
set format x '"%H:%M:%S"'
set autoscale y
set xrange ['"02:00:00"':'"02:00:31"']
set output './output/$title.png'
set grid
plot \"$file\" using 1:4 w lp pt 5,'' using 1:5 w lp pt 7
set output
set terminal wxt
" | gnuplot
fi
python绘图
最新推荐文章于 2024-06-01 19:30:06 发布