用点或其他图案填充gnuplot中的条形图

时间:2014-04-12 16:09:31

标签: gnuplot

我正在使用gnuplot(直方图)绘制一些条形图。我需要不同的和各种各样的模式来填补酒吧。使用" fs模式XX",我可以使用一些模式,但它们都是一些行。

我需要边框是实线(线型1),并且条形由点填充。如果我更改了图案的线型,那么边框也会改变。我想保持边界稳固。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我找到了一个支持点图案的终端:lua tikz终端:

set terminal lua tikz standalone
set output 'dot-pattern.tex'

set boxwidth 0.8 relative
set samples 10
unset key
set yrange [0:11]

plot '+' using 1:($0+1) with boxes lt -1 lw 2 lc rgb '#990000' fillstyle pattern 8
set output
system('pdflatex dot-pattern.tex')

enter image description here

通过这种方式,您还可以通过覆盖预定义的模式来使用自定义填充模式:

set terminal lua tikz standalone header '\tikzset{gp pattern 8/.style={pattern=mypatterh}}'

并且您必须定义自定义模式,如图所示 Custom and built in TikZ fill patterns

可以使用黑色边框和彩色填充图案
plot '+' using 1:($0+1) with boxes lc rgb '#990000' fillstyle pattern 8 noborder,\
     '+' using 1:($0+1) with boxes lt -1 lw 2
相关问题