๐Ÿ”™ Back to Top

Fri Aug 28 00:32:42 JST 2015

้™ๆฐด็ขบ็Ž‡ใฎใƒ—ใƒญใƒƒใƒˆ. gnuplot bash timefmt xdata

ไธปใซใ€ๆ™‚ๅˆปใ‚’็›ฎ็››ใ‚Šใซ็”จใ„ใŸใƒ—ใƒญใƒƒใƒˆใฎใŸใ‚ใฎgnuplotใ‚ณใƒžใƒณใƒ‰ใฎใƒกใƒขใ€‚

ใพใšใ€ใƒ‡ใƒผใ‚ฟใ‚’ๆ‹พใฃใฆใใ‚‹ใจใ“ใ‚

#!/bin/sh

curl -s http://sx9.jp/weather/tokyo-hongo.js |
grep ' \(0\|1\), ' |
sed 's/ *data.setValue([0-9]*,//g' | sed 's/);//g' | sed 's/[ \t]//g' |
sed 's#0,.\([0-9]*\)ๆœˆ\([0-9]*\)ๆ—ฅ\([0-9]*\)ๆ™‚\([0-9]*\)ๅˆ†.*#2015/\1/\2 \3:\4 #' |
sed 's#1,\([0-9]*\)#\1@#' |
tr -d '\n' | sed 's/@/\n/g' >data

ไธŠใ‚’ๅ‹•ใ‹ใ™ใจใ€ใ“ใ‚“ใชใƒ‡ใƒผใ‚ฟใŒๅพ—ใ‚‰ใ‚Œใ‚‹

2015/08/28 00:21 0
2015/08/28 00:22 0
2015/08/28 00:23 0
:

ใ“ใ‚Œใ‚’ใƒ—ใƒญใƒƒใƒˆใ™ใ‚‹

set terminal png
set output 'plot.png'

set xtics rotate by -60
set xdata time
set timefmt "%Y/%m/%d %H:%M"
set format x "%m/%d %H:%M"

set yrange [0:100]
set grid

set style fill solid border lc rgb "#00ffff"
set style line 1 lc rgb "#bbffff"
set style data filledcurves x1

plot 'data' using 1:3 smooth csplines linestyle 1 lw 3 with filledcurves

ๆ™ฎ้€šใชใ‚‰ with linepoint ใฎใจใ“ใ‚ใ‚’ smooth csplines ใจใ—ใฆใ‚‹. (ใƒ‡ใƒผใ‚ฟ็‚นใฎใ‚ใ„ใ ใ‚’็ตใถ็ทšใฎใชใ‚ใ‚‰ใ‹ใ•ใ‚’ๅค‰ใˆใ‚‹)