【问题标题】:Gnuplot grid format xtics mxticsGnuplot 网格格式 xtics mxtics
【发布时间】:2012-07-15 14:54:07
【问题描述】:

如何为主网格(xtics、ytics)定义一种格式,为次要网格(mxtics 和 mytics)定义另一种格式?

我试过了:

set style line 100 lt 1 lc rgb "gray" lw 2
set style line 101 lt 1 lc rgb "gray" lw 1
set grid xtics ytics ls 100
set grid mxtics mytics ls 101

但这需要所有网格的最后定义的 lw (1)。

【问题讨论】:

  • 这有点令人困惑,因为网格只在主要的记号处绘制。

标签: gnuplot


【解决方案1】:
set style line 100 lt 1 lc rgb "gray" lw 2
set style line 101 lt 0.5 lc rgb "gray" lw 1

set grid mytics ytics ls 100, ls 101
set grid mxtics xtics ls 100, ls 101

它确实有效:)。

【讨论】:

    【解决方案2】:

    gnuplot 还将使用set grid mxtics mytics 在轻微抽动处绘制网格线。

    要为主要网格线和次要网格线设置不同的线型,请使用正确的语法(用逗号分隔主要线型和次要线型):

    set style line 100 lt 1 lc rgb "blue" lw 2
    set style line 101 lt 1 lc rgb "gray" lw 1
    set grid mxtics mytics ls 100, ls 101
    

    【讨论】:

      【解决方案3】:

      还绘制了次要 tics mxtics 和 mytics,但格式与主要 tics 相同。当您想要区分它们时,这是一个问题。您使用箭头的解决方案起到了作用,但我发现首先绘制小刻度然后用主要的箭头覆盖它们更容易。坦克。

      set style line 100 lt 2 lc rgb "blue" lw 1
      set style line 101 lt 1 lc rgb "gray" lw 1
      
      # first draw the minor tics
      set xrange [0:1]
      set mxtics 10
      set yrange [0:1]
      set mytics 5
      set grid mxtics mytics ls 101
      
      # then the main tics
      dx=0.2  #grid spacing in x
      set for [i=1:5] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 100
      dy=0.2  #grid spacing in y
      set for [i=1:5] arrow from graph 0,graph i*dy to graph 1,graph i*dy nohead front ls 100
      
      plot sin(x)
      

      【讨论】:

        【解决方案4】:

        在gnuplot中,网格只绘制在主要的tic标记的位置,但是,如果你想有两个不同的网格,你可以使用箭头:

        set style line 101 lt 1 lc rgb "gray" lw 1
        dx=.1  #grid spacing in x
        set for [i=1:10] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 101 
        set xrange [0:1]
        plot sin(x)
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2023-03-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多