gnuplot horizontal space before first line point and after last

前端 未结 1 1309
失恋的感觉
失恋的感觉 2020-12-21 18:57

using: gnuplot 4.2 patchlevel 6

I am plotting candlesticks. The first and last data points are, of course, on the left and right Y axis bars. The first and last ca

相关标签:
1条回答
  • 2020-12-21 19:24

    That's what set offsets is for: Add some offsets to gnuplots autoscaled range:

    Without offsets (this is your case):

    $data <<EOD
    1 1
    2 2
    EOD
    plot $data with lp pt 7 ps 2 notitle
    

    With offsets in x-direction:

    $data <<EOD
    1 1
    2 2
    EOD
    set offsets 0.1, 0.1, 0, 0
    plot $data with lp pt 7 ps 2 notitle
    

    As you can see, you get offsets at the left and right plot margins. However, the margin's size isn't 0.1 in units of the first axis, but the value is rounded to the next auto-generated tic.

    To work around this, you can add set autoscale xfix:

    $data <<EOD
    1 1
    2 2
    EOD
    set offsets 0.1, 0.1, 0, 0
    set autoscale xfix
    plot $data with lp pt 7 ps 2 notitle
    

    0 讨论(0)
提交回复
热议问题