Message Boards Message Boards

How insert drawing pad into cell of GraphicsRow?

Posted 10 years ago

Given a graphics row something like this:

Clear["Global`*"];
g1 = Graphics[{White, Disk[]}, PlotRange -> {{-1, 1}, {-1, 1}}];
g2 =
  Graphics[{
    White,
    Rectangle[{-Sqrt[2]/2, -Sqrt[2/2]}]
    }];
GraphicsRow[{g1, g2}, Background -> Black]

I would like to be able to make a simple mouse-driven line drawing in one cell, say the right side. This cell will have other graphics predrawn within it. The following snippet written by Vitaliy Kaurov is about what I'm looking for in terms of functionality.

Manipulate[
 pts = If[Last[pts] == p, pts, pts~Join~{p}];
 ListLinePlot[pts, PlotRange -> {{-10, 10}, {-10, 10}}, PlotLabel -> Framed@Length[pts]],
 {{p, {0, 0}}, Locator},
 {{pts, {{0, 0}}}, ControlType -> None}]

See How to create a drawing pad in Mathematica?

I haven't had much luck putting these things together. Perhaps someone can steer me in the right direction. Eventually I want to embed this within a more complicated manipulate, but I'm trying to begin with the basics.

POSTED BY: Gary Palmer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract