“Graphics is not a Graphics primitive or directive.”?
The reason you are getting this error is that you are including the result of a plotting function inside a Graphics
expression. Since plotting functions produce Graphics
objects themselves you cannot nest them inside other Graphics
expressions. You need to use Show
to combine them.
Wrong way:
plot = Plot[x, {x, -2, 2}];
Graphics[{plot, Circle[]}]
Right way:
plot = Plot[x, {x, -2, 2}];
Show[ Graphics@Circle[], plot]
I'm guessing that you want the circle to move along the curve, so your code should be written like this:
f[x_] := 2 Sin[x/2]
Manipulate[
circle =
With[{u = x, v = f[x]},
{RGBColor[1, 0.27, 0.5], PointSize[Medium], Point[{u, v}], Circle[{u, v}, r]}];
Graphics[{box, circle, curve}, PlotRange -> {{-5.5, 50}, {-5.5, 20}}],
{circle, None},
{curve, None},
{box, None},
{x, 1, 50 - 5.5, Appearance -> "Labeled"},
{{r, 3}, 1, 5, .5, Appearance -> "Labeled"},
Initialization :> (
curve = (ParametricPlot[{z, f[z]}, {z, -5.5, 50}][[1]]);
box = {RGBColor[0.81, 0.79, 1], Rectangle[{40, 0}, {50, 10}]})]