[Scilab-users] {EXT} Re: finding reasonable axis markers for plotting a random data set

christophk christoph.knappe at gmail.com
Tue Nov 15 23:05:59 CET 2016


Hi Christoph and Samuel,

"Nevertheless, I think you could get something from:
- estimating the step size on the entire sample
- if 0 is inside, estimating the step size in each sub-range so there is at
least one step in this range
- taking the smallest step size
which would reduce the amount of "if" tests. "

Nice logic, Christophe! I do believe that this is sort of close to what I am
doing right now. There are a few extra if cases to catch problems, which
occur due to the rounding of ceil and floor. I guess there could be a more
elegant way to solve this, but I'm pretty happy the way my function works
now. There are a few exceptions with very odd intervals, where I would have
chosen a different xstart + stepsize compared to what was found and I guess
this could be solved by putting more thought into the "vec"-variable. I'll
go back to it when I have more time available. 

"Usually, nice steps for a linear axis are multiples of 1, 2 or 5 times 10^n
See also https://help.scilab.org/docs/6.0.0/en_US/graduate.html"

Good one, Samuel. This is exactly what I was looking for in the first place.
I was a bit disappointed, however, when I played around with graduate and
found out that graduate couldn't handle 5*5=25 as step sizes. Take the
following example:

xmin = 0;
xmax = 1;
[xstart,xstop,n]=graduate(xmin,xmax,4,4)

As a result I get prompted an interval of [0,2] with 0.5 as a stepsize, i.e.
0 0.5 1 1.5 2. 
I would have expected graduate to find a stepsize of 0.25, with an interval
of [0,1], i.e. 0  0.25  0.5  0.75  1. Clearly, 25=5*5 should be part of a
nice graduate solution. 
Perhaps this could be updated for a future scilab revision? 
In the meantime I'll just use the function I created myself, which I believe
works better for many cases. 

Thank you guys for all the valuable input and your suggestions, Christophe
and Samuel. You are awesome! :-) Just wondering - since the two of you
answer most questions here, are you from Scilab Enterprises or just fellow
Scilab users with a lot more experience than me?



--
View this message in context: http://mailinglists.scilab.org/finding-reasonable-axis-markers-for-plotting-a-random-data-set-tp4034957p4034988.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list