File: _pretty_lims.sci

package info (click to toggle)
scilab-plotlib 0.41-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,196 kB
  • sloc: xml: 3,308; makefile: 15
file content (23 lines) | stat: -rw-r--r-- 490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function out=_pretty_lims(db,tight)
  _max=db(2);
  _min=db(1);
  if (_max-_min)<%eps
    if abs(_min)<%eps
        _min=-1; _max=1;
    elseif _min<0
        _max=0;
        _min=2*_min;
    else
        _min=0;
        _max=_max*2;
    end
    out=[_min _max];
  elseif ~tight
//    magnitude=10^(int(log10(_max-_min)));
//    out=[floor(_min/magnitude);ceil(_max/magnitude)]*magnitude;
    [_min,_max]=graduate(_min,_max);
    out=[_min,_max];    
  else
    out=db;  
  end
endfunction