【问题标题】:Fill bars in gnuplot with dots or other patterns用点或其他图案填充 gnuplot 中的条
【发布时间】:2014-04-12 16:09:31
【问题描述】:

我正在使用 gnuplot(直方图)绘制一些条形图。我需要不同的图案来填充条形。使用“fs pattern XX”,我可以使用一些模式,但它们都是一些线条。

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

有什么想法吗?

【问题讨论】:

  • 要查看所有支持的填充模式,请使用test 命令。
  • 这些模式根本不够用。应该有更多不同密度、线型等的图案。
  • 那条评论是说:不,没有比这些更多的填充模式了;)
  • 但我只是在一篇论文中找到了一个样本。 dropbox.com/s/68st6u9axtyajw7/dot.png

标签: gnuplot


【解决方案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')

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

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

【讨论】:

  • 我正在尝试安装 lua。遇到一些问题,我无法安装它并检查您的答案。
  • 你运行什么系统?
  • ubuntu 12.04 LTS gnuplot v 4.6.4
  • 前段时间(不记得具体时间)我在 Debian 上也遇到了 lua 问题。这里的问题是,pkg-config --libs lua(在configure 文件中使用)不起作用。我必须执行以下操作才能使其正常工作:在运行 ./configure 之前运行 export LUA_CFLAGS=$(pkg-config --cflags lua5.1) LUA_LIBS=$(pkg-config --libs lua5.1)。我不记得你是否需要指定lua5.1lua5.0lua5
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-10-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多