python绘图

#!/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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值