【问题标题】:plotting two different types of histogram plots in gnuplot on top of each other在 gnuplot 中绘制两种不同类型的直方图
【发布时间】:2016-07-18 16:26:21
【问题描述】:

我正在使用 gnuplot 中的直方图,我想将其中一个直方图条放在其他结果的后面。我希望参考条(Mörk spennubjögunar > 200 kV)位于其他直方图条的后面。在使用不同的 y 轴之前,我已经在 excel 中完成了此操作,在 gnuplot 中有没有很好的方法来执行此操作?

这是我目前正在使用的代码。

set terminal pngcairo transparent nocrop enhanced size 3200,2400 font "arial,40" 
set output "Harmonic_currents_BRE.png"
set key right

set datafile separator ";"

set style line 12 lc rgb '#808080' lt 0 lw 1
set style line 13 lt 0 lw 3
set grid back ls 12

set xrange [-1:20]
set yrange [0:8]
set style data histogram
set style histogram cluster gap 1
set style fill solid border 0
set border lw 2
set boxwidth 0.7

set ylabel "Hlutfall af nafnspennu [%]"
set xlabel "Tíðni [pu 50 Hz base]"


plot "case0.csv"  using 2:xticlabels(1) title 'Tilfelli 0',\
     "case1.csv"  using 2:xticlabels(1) title 'Tilfelli 1',\
     "case2.csv"  using 2:xticlabels(1) title 'Tilfelli 2',\
     "case3.csv"  using 2:xticlabels(1) title 'Tilfelli 3',\
     "ref.csv"    using 2:xticlabels(1) title 'Mörk spennubjögunar > 200 kV'

unset output
unset zeroaxis
unset terminal

【问题讨论】:

    标签: gnuplot histogram


    【解决方案1】:

    我认为,最好的方法是先绘制具有固定框宽的参考with boxes(我使用了0.9),然后绘制聚类直方图:

    set style data histogram
    set style histogram cluster gap 1
    set style fill solid noborder
    set boxwidth 0.7
    
    plot "ref.csv" using 0:2:(0.9):xtic(1) with boxes title 'Mörk spennubjögunar > 200 kV',\
         for [i=0:3] sprintf("case%d.csv", i) u 2 title sprintf('Tilfelli %d), i)
    

    【讨论】:

    • 您好,感谢您的回复,我正在使用 gnuplot 5,当我尝试使用此方法时,它会变为错误栏:“此绘图样式不适用于 3 列。设置为 yerrorbars”
    • 呃,是的,我错过了参考图的中心部分 with boxes
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多