How do I draw a set of vertical lines in gnuplot?

后端 未结 5 518
眼角桃花
眼角桃花 2020-12-08 19:28

E.g. if I have a graph and want to add vertical lines at every 10 units along the X-axis.

5条回答
  •  不思量自难忘°
    2020-12-08 19:40

    To elaborate on previous answers about the "every x units" part, here is what I came up with:

    # Draw 5 vertical lines
    n = 5
    
    # ... evenly spaced between x0 and x1
    x0 = 1.0
    x1 = 2.0
    dx = (x1-x0)/(n-1.0)
    
    # ... each line going from y0 to y1
    y0 = 0
    y1 = 10
    
    do for [i = 0:n-1] {
        x = x0 + i*dx
        set arrow from x,y0 to x,y1 nohead linecolor "blue" # add other styling options if needed
    }
    

提交回复
热议问题