gnuplot:在绘图点后面绘制网格并在前面绘制网格

标签 gnuplot

如果数据点靠近轴,我很难在图表后面绘制网格线并将轴刻度线保持在它们前面。

考虑这些名为“t_data”的示例数据:

   0   1
   1   3
   1.8 0
   3   5
   4   0
   5   2

这个脚本:

reset session

set terminal pdfcairo enhanced color font "Arial,10" size 7.5cm,6cm

set output "t_graph.pdf"

set style line 1 lc rgb "#ff0000" lw 1 pt 5 ps 0.5 pi -1
set pointintervalbox 0.7

unset key
unset title
unset border

set border 3
set xrange [0:5]
set yrange [0:*]

set xtics border nomirror out font "Arial,9"
set ytics border nomirror out font "Arial,9"

set mxtics 5
set mytics 5

set xlabel "x"
set ylabel "y"

set grid xtics mxtics ytics back lt -1 lw 1 lc rgb "#808080", lt -1 lw 1 lc rgb "#808080" dt 2
set tics front

plot "t_data" u 1:2 w lp ls 1

set out

为了使刻度线位于 x=0, 24 处的数据点前面,我阅读了例如此处的内容 ( gnuplot: fill area curve keeping tics on top ) set tics front 命令应位于 plot 命令之前,如脚本中所示。然而,这似乎覆盖了我为 set grid 命令提供的选项 back ,即网格也绘制在我的图表顶部(它甚至说 Grid当我在执行上面的脚本后运行 show grid 时在前面绘制)。

当我互换set gridset tics命令时,网格和抽动都被绘制在绘图点后面,从而部分地掩盖了主要抽动标记和次要刻度标记完全(注意,在任何一种情况下,轴仍然绘制在绘图点的顶部)。

任何人都可以帮助我,弄清楚如何获得绘图点后面的网格和它们前面的刻度线(我认为这种绘制图表的方式最有意义,但这实际上只是恕我直言)?我也很好奇为什么 set ticsset grid 命令似乎相互影响。

我在 OpenSUSE 42.3 LTS 上使用 gnuplot 版本 5.0 patchlevel 0(如果这很重要的话)。

最佳答案

我认为这个问题已在 Gnuplot 的 5.0.2 版本中修复。对应Changelog状态:

2015-11-09 Ethan A Merritt

  • src/axis.c src/axis.h src/graphics.c src/save.c src/set.c src/show.c src/unset.c: The documentation says that "set tics front or back controls whether the tics are placed behind or in front of the plot elements". This was sort of true but it did this by moving the entire grid along with the tics, so you could not entirely place the tics and tic labels in front of the grid lines. Decouple these two operations so that set tics {front|back} does only what it is documented to do. Bug #1704

  • src/axis.c (gen_tics): "set {*}tics rangelimit" applies to minor tics as well as to major tics. Bug #1705

关于gnuplot:在绘图点后面绘制网格并在前面绘制网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52905736/

相关文章:

gnuplot:绘制 X、Y 坐标及其标签

plot - 如何在图形上绘制卡方 - gnuplot

gnuplot - 如何在gnuplot中使用一列数据作为图例?

gnuplot - 如何用精确值标记 x 轴

gnuplot - 如何正确地将透视图添加到代表分子的 Gnuplot 3D 连接点云?

gnuplot - gnuplot 中同一个图上有多个拟合线?

gnuplot - 在 Gnuplot 中的箱线图中标记离群值

Gnuplot 多图 : Convenient method for creating more complex layouts

gnuplot - gnuplot 和 postscript 终端中的嵌套循环

gnuplot - 如何修复 GNUPLOT 重绘问题