[racket] Plot silently fails for some characters in y-label

From: Deren Dohoda (deren.dohoda at gmail.com)
Date: Fri Apr 25 20:48:41 EDT 2014

Hi Neil,

I have the 32-bit version installed on my Win7 machine at home, too. I was
able to reproduce my own problem here as well.

When I run your example, the first plot looks like I'd expect. The second
one does not have the circle. If I remove the \circ from the text-extent it
doesn't change anything. If I remove \circ from the text-extent and the
draw-text, then the circle appears. If I remove \circ from only draw-text
(leaving it in text-extent), the circle also appears. I did take a
screenshot if you want to see it. Otherwise, the numbers are

39.0
13.5
2.5
0.0
31.0
13.5
2.5
0.0

I then uninstalled the 32-bit version, downloaded and installed the x86_64
version, and reran your example. The same thing happened again.

Something maybe helpful: when the \circ is in the string for draw-text the
text is NOT rotated 90 degrees counter-clockwise. When the \circ is
removed, the text is drawn rotated 90 degrees counter-clockwise.

...Ah, I see Kieron has uploaded an image to show. That is exactly what I
see.

Deren


On Fri, Apr 25, 2014 at 6:39 PM, Neil Toronto <neil.toronto at gmail.com>wrote:

> I can't replicate this problem on my machine, so I'll need more
> information. Can you run the following program and reply with what you see?
>
>
> #lang racket
>
> (require racket/draw plot)
>
> (plot (function sin #e1e-157 #e1e-156))
>
> (define bm (make-bitmap 400 400))
> (define dc (make-object bitmap-dc% bm))
> (send dc set-smoothing 'smoothed)
> (send dc set-scale 2 2)
> (send dc set-font (make-font #:size (plot-font-size)
>                              #:family (plot-font-family)
>                              #:size-in-pixels? #t))
> (send dc get-text-extent "X (⇑∘C)" #f #t 0)
> (send dc draw-text "X (⇑∘C)" 80 180 #t 0 0)
> (send dc get-text-extent "Y (∘C)" #f #t 0)
> (send dc draw-text "Y (∘C)" 10 120 #t 0 (/ pi 2))
> (send dc draw-ellipse 30 30 140 140)
> bm
>
>
> It should produce a simple plot with tick labels on both axes with the
> superscripted exponent "-157", a collection of numbers that looks something
> like this:
>
> 110.0
> 13.5
> 3.0
> 0.0
> 34.0
> 13.5
> 3.0
> 0.0
>
> and a bitmap with a circle and the X and Y axis labels you expect, with
> approximately the placement and orientation you expect them on a plot
> (though bigger).
>
> Neil ⊥
>
>
> On 04/25/2014 03:39 PM, Deren Dohoda wrote:
>
>> Short story: put a \circ in the y-label and plotting fails?
>>
>> Racket 6.0 32-bit on 64-bit Windows 7. Using DrRacket. The plot frame is
>> generated, the plot title and x-label appear, the tick marks on the axes
>> appear, but the y-label doesn't appear and neither (points ...) nor
>> (function ...) appear.
>>
>> Example code (hopefully the extra characters come through email
>> correctly):
>>
>> #lang racket
>> (require plot)
>>
>> (define (make-p title y-label)
>>    (plot (function (λ(x) x))
>>          #:x-min 0 #:x-max 50
>>          #:y-min 0 #:y-max 50
>>          #:x-label "X (⇑∘C)"
>>          #:y-label y-label
>>          #:title title))
>>
>> (define-values (works doesnt-work)
>>    (values (make-p "Works (⇓∘C)" "Y (C)")
>>            (make-p "Doesn't Work (⇓∘C)" "Y (∘C)")))
>>
>> works
>> doesnt-work
>> ;;;;;;;;;;;;;;;;;;;;;
>>
>>
>> It's not just arbitrary character substitutions, for instance all the
>> \left|right|up|downarrow don't cause any problems, but
>> \Down|Up|etc.arrow causes the same problem as \circ. I threw some in the
>> title and x-label to show that they didn't cause any failures. I've
>> attached an image of what appears in case it helps.
>>
>> Deren
>>
>>
>> ____________________
>>    Racket Users list:
>>    http://lists.racket-lang.org/users
>>
>>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140425/58efc71e/attachment.html>

Posted on the users mailing list.