Gnuplot 条形图不从零开始
Gnuplot bar chart doesn't start at zero
我的 GNUplot 5.2 图:
$heights << EOD
dad 181
mom 170
son 100
daughter 60
EOD
set terminal png
plot '$heights' using 2:xtic(1) with boxes
如你所见,“女儿”并不是从零开始的。我尝试了 set yzeroaxis
from the documentation,但似乎没有任何影响。
奖励:如何删除 $heights using 2:xtic(1)
行?
可以使用命令Xrange和Yrange来设置轴的范围:
set yrange [0:200]
set xrange [-1:4]
plot '$heights' using 2:xtic(1) with boxes notitle
附加参数 notitle 删除密钥。
法比奥拉的回答是正确的,但可以改进以显示更多选项
set yrange [0:*] # start at zero, find max from the data
set boxwidth 0.5 # use a fixed width for boxes
unset key # turn off all titles
set style fill solid # solid color boxes
plot '$heights' using 2:xtic(1) with boxes
我的 GNUplot 5.2 图:
$heights << EOD
dad 181
mom 170
son 100
daughter 60
EOD
set terminal png
plot '$heights' using 2:xtic(1) with boxes
如你所见,“女儿”并不是从零开始的。我尝试了 set yzeroaxis
from the documentation,但似乎没有任何影响。
奖励:如何删除 $heights using 2:xtic(1)
行?
可以使用命令Xrange和Yrange来设置轴的范围:
set yrange [0:200]
set xrange [-1:4]
plot '$heights' using 2:xtic(1) with boxes notitle
附加参数 notitle 删除密钥。
法比奥拉的回答是正确的,但可以改进以显示更多选项
set yrange [0:*] # start at zero, find max from the data
set boxwidth 0.5 # use a fixed width for boxes
unset key # turn off all titles
set style fill solid # solid color boxes
plot '$heights' using 2:xtic(1) with boxes