<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 10, 2013, at 7:04 PM, J G Cho wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Grande'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">I get an error (somewhat expectedly) when I try<div><br></div><div><div> (big-bang init</div><div> (on-tick random-walk 1)</div><div> ;(on-key door-actions)</div><div> (to-draw plot-render)</div><div> ))</div></div><div><br></div><div>where plot-render is defined as</div><div><br></div><div><div>(define (plot-render world)</div><div> (p:plot (p:lines</div><div> (world->list-of-vectors world)</div><div> #:color 6 #:label "Random walk")))</div></div><div><br></div><div>with the following at the top</div><div><br></div><div>(require (prefix-in p: plot))<br></div><div><br></div><div>The error msg is</div><div><br></div><div>plot: could not determine sensible plot bounds; got x ∈ [0,0], y ∈ [1,1]<br></div><div><br></div><div>Is there way to let plot know of the context? Or pass a context to plot and extract the pixels and hand it over to via some proc in 2htdp/image? Or maybe there is a simple way?</div></span></blockquote></div><br><div><br></div><div>This works like a charm for me: </div><div><br></div><div><div>#lang racket </div><div><br></div><div>(require (prefix-in p: plot) 2htdp/universe)</div><div><br></div><div>(define (plot-render world)</div><div> (p:plot (p:lines (world->list-of-vectors world)</div><div> #:color 6 #:label "Random walk")))</div><div><br></div><div>(define (world->list-of-vectors world)</div><div> `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div> 'more-dummy)</div><div><br></div><div>(big-bang 'dummy ; init </div><div> (on-tick random-walk 1)</div><div> (to-draw plot-render))</div></div><div><br></div><div>;; --- </div><div><br></div><div>When I had a student implement the first plot version, I intentionally made sure that plot returned something I could use in big-bang. </div><div><br></div><div>And btw, this works too: </div><div><br></div><div><div>#lang racket </div><div><br></div><div>(require (prefix-in p: plot) 2htdp/universe 2htdp/image)</div><div><br></div><div>(define (plot-render world)</div><div> (overlay </div><div> (p:plot (p:lines (world->list-of-vectors world)</div><div> #:color 6 #:label "Random walk"))</div><div> (square 800 'solid 'blue)))</div><div><br></div><div>(define (world->list-of-vectors world)</div><div> `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div> 'more-dummy)</div><div><br></div><div>(big-bang 'dummy ; init </div><div> (on-tick random-walk 1)</div><div> (to-draw plot-render))</div></div><div><br></div></body></html>