【发布时间】:2017-03-21 22:36:16
【问题描述】:
昨天我提出了一个类似的问题 (this one)。我无法在 gnuplot 直方图中显示条形顶部的值。我浪费了很多时间,因为我找不到关于它的真正好的文档,而且我只能在不同的网站上找到类似的问题。
我为此浪费了很多时间,但幸运的是有人给了我解决方案。现在,我在带有两个条形图的直方图上遇到了类似的问题,我必须将其值放在两个条形图的顶部。我已经很近了,或者这就是我的想法,但我无法使其正常工作。我多次更改脚本并重新生成图表,但我不确定自己在做什么。
script.sh
#!/usr/bin/gnuplot
set term postscript
set terminal pngcairo nocrop enhanced size 600,400 font "Siemens Sans,8"
set termoption dash
set output salida
set boxwidth 0.8 absolute
set border 1
set style fill solid 1.00 border lt -1
set key off
set style histogram clustered gap 1 title textcolor lt -1
set datafile missing '-'
set style data histograms
set xtics border in scale 0,0 nomirror autojustify
set xtics norangelimit
set xtics ()
unset ytics
set title titulo font 'Siemens Sans-Bold,20'
set yrange [0.0000 : limite1] noreverse nowriteback
set y2range [0.0000 : limite2] noreverse nowriteback
show style line
set style line 1 lt 1 lc rgb color1 lw 1
set style line 2 lt 1 lc rgb color2 lw 1
## Last datafile plotted: "immigration.dat"
plot fuente using 2:xtic(1) ls 1 ti col axis x1y1, '' u 3 ls 2 ti col axis x1y2, '' u 0:2:2 with labels offset -3,1 , '' u 0:2:3 with labels offset 3,1
我正在修改最后一行代码,因为这里是我设置标签的地方。我已经能够显示两个标签,但是在不好的位置上,我也能够在正确的位置显示一个标签,但不能显示另一个。除了我想要的东西,我几乎可以展示所有东西。这是生成脚本的图表。
输出.png
这是我用来生成图表的源文件
source.dat
"Momento" "Torre 1" "Torre 2"
"May-16" 1500.8 787.8
"Jun-16" 1462.3 764.1
"Jul-16" 1311.2 615.4
"Ago-16" 1199.0 562.0
"Sep-16" 1480.0 713.8
"Oct-16" 1435.1 707.8
这就是我使用参数集执行的命令
gnuplot -e "titulo='Energía consumida por torre (MWh)'; salida='output.png'; fuente='source.dat'; color1='#FF420E'; color2='#3465A4'; limite1='1800.96'; limite2='945.36'" script.sh
我认为这很明显我在假装,有人可以帮助我吗?
非常感谢。
【问题讨论】: