GNUPLOT-Can';t在条形图上显示值

GNUPLOT-Can';t在条形图上显示值,gnuplot,histogram,Gnuplot,Histogram,我正在用这个文件“.dat”制作简单的直方图 Moment "Energy consumed (MWh)" "Apr-16" 2011.4 "May-16" 1869.6 "Jun-16" 1899.0 "Jul-16" 1659.0 "Aug-16" 1740.6 "Sep-16" 1670.0 为此,我写了以下脚本 #!/usr/bin/gnuplot set term postscript set terminal pngcairo nocrop enhanced size

我正在用这个文件“.dat”制作简单的直方图

Moment "Energy consumed (MWh)"
"Apr-16" 2011.4
"May-16" 1869.6
"Jun-16" 1899.0
"Jul-16" 1659.0
"Aug-16" 1740.6
"Sep-16" 1670.0
为此,我写了以下脚本

  #!/usr/bin/gnuplot
  set term postscript
  set terminal pngcairo nocrop enhanced size 700,700 font "arial,18"
  set termoption dash
  set output out
  set boxwidth 0.5 absolute
  set border 0
  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
  set yrange [0.0000 : limite] noreverse nowriteback

  show style line
  set style line 1 lt 1 lc rgb color lw 1

  ## Last datafile plotted: "immigration.dat"
  plot fuente using (column(0)):2:xtic(1) title titulo ls 1 with boxes, '' using 0:2:2 with labels
在本例中,
out
是输出文件名,
titulo
是显示在图像输出顶部的标签,
limite
是我在y-axi上用作最大值的值,
fuente
是源文件名

结果是这样的

我正在尝试以一定的偏移量显示条上的值,因为我需要条上的值,而不是条内的值。我需要单独的代码,我正在尝试这样的代码:

plot fuente using (column(0)):2:xtic(1) title titulo ls 1 with boxes, '' using 0:($2 + 0.5):2 with labels
因为我看到很多网站都在做
$2+0.5
,但这对我来说并不管用


我该怎么办?请帮帮我,我完全迷路了。提前感谢。

使用带有标签的<代码>打印样式的<代码>偏移量参数。使用此选项,您可以添加您指定的垂直偏移,例如在
字符
图形
单位中:

plot fuente using 0:2:xtic(1) with boxes, '' using 0:2:2 with labels offset 0, char 1

旁注:将
0.5
的常量值添加到y值(比如
$2+0.5
)对你不起作用,因为
0.5
是以y轴为单位的,与你的y轴相比非常小。

我花了很多时间,非常感谢你看到了你的gnuplot声誉,你能帮我吗@克里斯托夫