How do I make the number of digits after decimal to be the same in y-ticks
?
Do you mean A) write ".100", or B) have only .01, .02, .03, etc. and not .015, etc.?
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>.
I mean the option A. Let me look at the example. Thanks.
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)
you need (require srfi/13)
for string-index
Is there a way to get the tlayout
from the plot itself, since I just want to format the existing ones?
great!
works well.
awesome
@67j8vwjc4oud has joined the channel