I made a plot-canvas% class that I use. The new plot package made it pretty easy. But it doesn't support the rotation, etc functionality from the snip. It does, however, support printing which is nice.<br><br>On Monday, February 6, 2012, Neil Toronto <<a href="mailto:neil.toronto@gmail.com">neil.toronto@gmail.com</a>> wrote:<br>
> Yes, because a plot is a snip%. It's easy to do something quick and dirty.<br>><br>> But doing it right takes more than just a few object creations and method calls. You also need to disable edit operations, hide the caret, etc., without disabling the editor itself. If it's disabled entirely, it won't receive mouse events.<br>
><br>> So it's... easy, but not entirely straightforward? That's probably the best description, and also why it might be a good idea for me to add `plot-canvas' and `plot3d-canvas' functions, or a plot-canvas% class.<br>
><br>> Neil ⊥<br>><br>> On 02/06/2012 06:48 PM, Robby Findler wrote:<br>>><br>>> Just to be sure I'm understanding: you can put this into any GUI where<br>>> you can put an editor-canvas% object, right? So it should just be a<br>
>> couple of object creations and method calls to get this going?<br>>><br>>> Robby<br>>><br>>> On Mon, Feb 6, 2012 at 5:41 PM, Neil Toronto<<a href="mailto:neil.toronto@gmail.com">neil.toronto@gmail.com</a>> wrote:<br>
>>><br>>>> On 02/06/2012 04:14 AM, Nikolaus Klepp wrote:<br>>>>><br>>>>> Hi!<br>>>>><br>>>>> When I create a 3D plot in DrRacket, I can rotate the plot by clicking on<br>
>>>> it<br>>>>> and dragging the mouse. Now I would like to embed the same plot with the<br>>>>> same<br>>>>> ability in my GUI. Is there an easy way to do that?<br>>>><br>
>>><br>>>> Great idea!<br>>>><br>>>> Unfortunately, I didn't think of making an easy way to do it. Fortunately,<br>>>> `plot' already does something similar: if you set (plot-new-window? #t),<br>
>>> plots appear on a canvas in a new frame. You just need to do that without<br>>>> the frame.<br>>>><br>>>> The relevant code is in "<racket-dir>/collects/plot/common/gui.rkt",<br>
>>> specifically the `make-snip-frame' function.<br>>>><br>>>> The basic idea is to make a canvas containing a single read-only-text% that<br>>>> is initially writable, insert the snip (which you get from `plot-snip' or<br>
>>> `plot3d-snip'), and then set the text to read-only. If you want to change<br>>>> the plot, set the text writable, delete the snip, insert the new one, and<br>>>> set it read-only again.<br>
>>><br>>>> If you don't mind my asking, what are you plotting in your gui?<br>>>><br>>>> Neil ⊥<br>>>><br>>>> ____________________<br>>>> Racket Users list:<br>
>>> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br>><br>> ____________________<br>> Racket Users list:<br>> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br>
>