【问题标题】:Gnuplot scatter with xticlabels and errorbars带有 xticlabels 和误差线的 Gnuplot 散点图
【发布时间】:2015-09-16 11:55:17
【问题描述】:

我正在尝试在 GNUPLOT 中使用 Y 误差条绘制散点图,其中 X 轴是“名称”,而不是数字。 我正在使用此代码:

    #!/bin/sh

gnuplot -persist <<PLOT

set boxwidth 0.99 relative #ancho relativo de las barras

set border linewidth 1.5
set xlabel "xlabel" font "Verdana,18"
set xlabel offset 0,-1
#set xrange [-5:5]
set xtics font "Verdana,12"
set ylabel "ylabel" font "Verdana,18"
set ylabel offset -2,0
set yrange [-15:15]
set ytics font "Verdana,12"
set key at 4,4 font "Verdana,18"
set style line 1 lc rgb '#0060ad' pt 7   # circle
set xtics rotate by -45 #rota ángulo

plot "file.txt" using 0:2:3:xticlabels(1) with yerrorbars ls 1
quit
PLOT

作为一个bash脚本,那么file.txt就是:

Peter   3.06 0.5035
Charles 4.6576 0
Luis -13.1790 0

第三列是 Y 误差线。然而,当使用直方图时,数据似乎完全在原点开始,而不是像往常一样...... 任何关于“移位”或在 X 上设置非数值范围的线索? 提前谢谢你。

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    如果你想在 x 轴上使用自动缩放并且只是在左右两侧添加一些空间,那么使用set offset

    set yrange [-15:15]
    set style line 1 lc rgb '#0060ad' pt 7   # circle
    set xtics rotate by -45
    set offset 0.5,0.5,0,0
    plot "file.txt" using 0:2:3:xticlabels(1) with yerrorbars ls 1 notitle
    

    【讨论】:

      猜你喜欢
      • 2012-10-13
      • 1970-01-01
      • 2021-11-11
      • 2013-02-28
      • 1970-01-01
      • 1970-01-01
      • 2012-08-14
      • 2014-05-09
      • 1970-01-01
      相关资源
      最近更新 更多