arifshaikh.astro
2021-11-5 10:12:58

How do I make the number of digits after decimal to be the same in y-ticks ?


laurent.orseau
2021-11-5 10:43:34

Do you mean A) write ".100", or B) have only .01, .02, .03, etc. and not .015, etc.?


laurent.orseau
2021-11-5 10:50:54

In any case, if you want full control over the plot ticks, the best way is to write your own https://docs.racket-lang.org/plot/ticks_and_transforms.html#%28def._%28%28lib._plot%2Fmain..rkt%29._ticks%29%29\|ticks and defining the layout and format functions. See <https://gist.github.com/Metaxal/0cb555abb0d928d2d892ee92580d3623|here for an example>.


arifshaikh.astro
2021-11-5 11:04:04

I mean the option A. Let me look at the example. Thanks.


laurent.orseau
2021-11-5 11:16:02

You could adapt the example to use something like this: (define (concat-zeros x #:precision [precision 6]) (define s (~r x #:precision precision)) (define .idx (string-index s #\.)) (cond [.idx (string-append s (make-string (max 0 (+ 1 (- precision (- (string-length s) .idx)))) #\0))] [else s])) (define (tformat low high pre-ticks) ; custom formatter of the major tick labels (map (λ (p) (concat-zeros (pre-tick-value p) #:precision 4)) pre-ticks)) (expect it to be buggy though)


laurent.orseau
2021-11-5 11:20:03

you need (require srfi/13) for string-index


arifshaikh.astro
2021-11-5 11:28:09

Is there a way to get the tlayout from the plot itself, since I just want to format the existing ones?



arifshaikh.astro
2021-11-5 11:47:54

great!


arifshaikh.astro
2021-11-5 11:58:26

works well.


laurent.orseau
2021-11-5 11:59:05

awesome


67j8vwjc4oud
2021-11-5 22:29:54

@67j8vwjc4oud has joined the channel