Ah, thanks Alex, that helps!
Actually, the problem was slightly more complex than that.
First, note that your fix should use the value of the pretick rather than
the position in the list of preticks.
Now, I logged the values of the preticks that plot was generating, and it
looked something like this:
(#(struct:pre-tick 1 #t) #(struct:pre-tick
7426988859172397/4503599627370496 #t) #(struct:pre-tick 2 #t)
#(struct:pre-tick 3 #t))
which means I get some non-integer rationals sometimes.
So the proper fix is (I believe):
(for/list ([t pre-ticks])
(define idx (pre-tick-value t))
(if (and (exact-nonnegative-integer? idx)
(< idx N))
(list-ref string-list idx)
One last problem that may remain is that in my logs sometimes some integers
values are skipped, but this doesn't seem to appear on the screen, so maybe
these are just temporary values.
On Sat, Oct 15, 2016 at 12:31 AM, Alex Harsanyi <alexharsa...@gmail.com>
> Your tick format function returns less labels than the number of items in
> the pre-ticks. It should return one label for each pre-tick object (I just
> printed out the lengths from the function to find this out.)
> To fix this, I replaced the format function with
> (for/list (((t idx) (in-indexed pre-ticks)))
> (list-ref string-list idx))
> On Friday, October 14, 2016 at 5:28:08 PM UTC+8, Laurent Orseau wrote:
> > Hi all,
> > I'm trying to write a `string-ticks` function to have arbitrary strings
> on the (y) axis.
> > It mostly works, but as soon as I try to zoom by selecting a rectangle
> *that touches upper left corner of the plot frame* DrRacket's interaction
> window goes crazy and I have to restart it.
> > Here's the (faulty) code:https://gist.github.com/Metaxal/
> > Anyone has an idea about what goes wrong here?
> > Thanks,
> > Laurent
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.