Gnuplot change color of bars in histogram

后端 未结 4 1192
遥遥无期
遥遥无期 2020-12-25 15:19

is it possible to change the color of bars in a Gnuplot script dynamically? I have the following script

reset
fontsize = 12
set term postscript enhanced eps         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-25 15:57

    You could split your data file into two parts, positive values and negative, and plot them separately:

    plot 'bm_speedup_pos.dat' using 2:xtic(1) ti "Faster" linecolor rgb "#00FF00", \
         'bm_speedup_neg.dat' using 2:xtic(1) ti "Slower" linecolor rgb "#FF0000"
    

    Or, if you only need to generate a few graphs, a few times, a common technique is to generate the raw graph in gnuplot, then post-process it in an image editor to adjust the colors. If you go that route, I suggest having gnuplot generate the graph in SVG format, which will give you much better looking graphs than any of the bitmap formats.

提交回复
热议问题