<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>&nbsp; (big-bang init</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (on-tick random-walk 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;(on-key door-actions)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (to-draw plot-render)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ))</div></div><div><br></div><div>where plot-render is defined as</div><div><br></div><div><div>(define (plot-render world)</div><div>&nbsp; (p:plot (p:lines</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(world-&gt;list-of-vectors world)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#: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:&nbsp;</div><div><br></div><div><div>#lang racket&nbsp;</div><div><br></div><div>(require (prefix-in p: plot) 2htdp/universe)</div><div><br></div><div>(define (plot-render world)</div><div>&nbsp; (p:plot (p:lines (world-&gt;list-of-vectors world)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#:color 6 #:label "Random walk")))</div><div><br></div><div>(define (world-&gt;list-of-vectors world)</div><div>&nbsp; `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div>&nbsp; 'more-dummy)</div><div><br></div><div>(big-bang 'dummy ; init&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (on-tick random-walk 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (to-draw plot-render))</div></div><div><br></div><div>;; ---&nbsp;</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.&nbsp;</div><div><br></div><div>And btw, this works too:&nbsp;</div><div><br></div><div><div>#lang racket&nbsp;</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>&nbsp; (overlay&nbsp;</div><div>&nbsp; &nbsp;(p:plot (p:lines (world-&gt;list-of-vectors world)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #:color 6 #:label "Random walk"))</div><div>&nbsp; &nbsp;(square 800 'solid 'blue)))</div><div><br></div><div>(define (world-&gt;list-of-vectors world)</div><div>&nbsp; `(#(1 3) #(2 -2) #(4 3)))</div><div><br></div><div>(define (random-walk world)</div><div>&nbsp; 'more-dummy)</div><div><br></div><div>(big-bang 'dummy ; init&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (on-tick random-walk 1)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (to-draw plot-render))</div></div><div><br></div></body></html>