Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1231 auto-extension of log-scaled axes gives strange results

5.0
closed
nobody
None
5
2014-01-10
2013-04-12
Ethan Merritt
No

All versions of gnuplot that I have tried (4.2 - 4.7) give unreasonable results for the following sequence of commands
set log y
set ytics 20
plot 'silver.dat'
It extends ymax to 10^20 rather than to the next multiple of 20. It doesn't seem to extend ymin at all. This is clearly wrong, but what exactly should it do instead? Should it just ignore range extension for log-scaled axes? The simple-minded fix of applying AXIS_LOG_VALUE in the round_out() routine produces a more reasonable bound for ymax in this particular case, but blows up in evaluating ymin whenever the extension would reach 0.

Discussion

  • aloisius
    aloisius
    2013-04-16

    Hi Ethan,

    if ytics is set to 20 you have to compute the integer-bounds of log_20 ( data ).
    In my example, this is -3 , 4.
    so the autorange for the logscale plot should compute bounds from 20**(-3) to 20**4
    like you see it in the second plot

    # create log plot to base 20 by hand
    unset logscale y
    set ytics 1        # ytics  in power of 20
    plot "-"     u 1:( log($2)/log(20) )
    1  20000.
    2  10000.
    3  8000.
    4  2000.
    5  400.
    6  20.
    7  4.
    8  1.
    9  0.2
    10. 0.0012
    e
    
    pause -1 "RETURN"
    
    # get log_20  bounds of data
    #  reach from -3 to 4
    
    ymin  = int (GPVAL_DATA_Y_MIN) -1
    ymax  = int (GPVAL_DATA_Y_MAX) +1
    
    set ytics 20
    set logscale y
    set yrange [ 20**ymin: 20**ymax] # This setting should be computed automatically
    plot "-" u 1:2
    1  20000.
    2  10000.
    3  8000.
    4  2000.
    5  400.
    6  20.
    7  4.
    8  1.
    9  0.2
    10. 0.0012
    e
    
     
  • Ethan Merritt
    Ethan Merritt
    2014-01-10

    • status: open --> closed