0
$\begingroup$

I read Show's documentation but couldn't understand why it fails. Here's the relevant code:

(* graphics *)
profile := ParametricPlot[beta[t], {t, 0, Evaluate[Roll[4*length1, B]][[1]]},
    PlotRange -> All, Axes -> False, Background -> GrayLevel[0.9]];
gen[s_] := ParametricPlot[Evaluate[ff[t, s]], {t, 0, 2*Pi}, PlotRange -> All,
    PlotStyle -> {{Thickness[0.005], Darker[Green]}}, Axes -> False,
    Background -> GrayLevel[0.9]];
trajectory := Evaluate[ParametricPlot[Evaluate[Roll[s, B]], {s, 0, 2*length1},
    PlotRange -> All, PlotStyle -> {{Thickness[0.008], Purple}},
    Axes -> False, Background -> GrayLevel[0.9], PlotPoints -> 100]];
contactPoint[s_] := Graphics[{Red, PointSize[0.025], Point[beta[s]]}];
trajectoryPoint[s_] := Graphics[{Purple, PointSize[0.025], Point[Roll[s, B]]}];

FG[s_] := Show[trajectory, gen[s], trajectoryPoint[s], profile,
    contactPoint[s], PlotRange -> {{-b1, 2*length1 + b1}, {-0.6, 2*b1 + 0.6}},
    ImageSize -> {300, 300}];
Animate[FG[s], {s, 0, 2*length1}]

The functions used in this code (beta, Roll, etc.) work, and I can see that by plotting the single elements. However, when combining them with Show, this is the result: show

If I draw a single frame, this is the result: show2

I searched extensively for these errors, but couldn't find anything relevant:

Ignoring invalid graphics directive Opacity[Skeleton[1]].
Ignoring invalid graphics directive Opacity[Skeleton[1]].
Coordinate {Skeleton[2]} should be a pair of numbers, or a Scaled or Offset form.

I think the problem has to do with the different graphic objects having different coordinates. Is that why it cannot combine them? I find the errors to be really cryptic.

Here is a notebook reproducing the problem. I am using Mathematica 11.

$\endgroup$
  • 2
    $\begingroup$ Please provide all definitions needed to reproduce the problem $\endgroup$ – Kuba Apr 21 '17 at 7:47
  • 2
    $\begingroup$ No you won't. Please reduce the code to the minimal working example. Drop all parts that are not needed to recreate the problem. E.g. it seems only the first arg in Show is enough to show it. $\endgroup$ – Kuba Apr 21 '17 at 8:01
  • 2
    $\begingroup$ The only way to solve this problem is to construct a minimal example. Surely, it is not that hard to isolate the problem. You just keep removing pieces from the code until the problem disappears, to identify where it is. Why didn't you do this instead of posting the whole notebook? You have Show[a,b,c,d,e...]: then try removing a first, is there problem there? Yes? Then remove b too, etc. Find which one is "bad". Expand function definitions. Look at the options in Show, remove them. This is something that you can do easily. Do it next time. $\endgroup$ – Szabolcs Apr 21 '17 at 8:47
  • 1
    $\begingroup$ Anyway, the problem is that in Show, you have a \[RightArrow] after PlotRange instead of a \[Rule]. Maybe you copied this from somewhere or entered it in a non-standard way. Rules are entered as ->, i.e. dash-greater. $\endgroup$ – Szabolcs Apr 21 '17 at 8:48
  • 2
    $\begingroup$ Another thing: please always show us the same code that causes the error, and always try running the code that you post here. What you posted here did not have a \[RightArrow], it has a ->. $\endgroup$ – Szabolcs Apr 21 '17 at 8:50
1
$\begingroup$

Show is unable to combine the Options for some reason. Workaround is to provide the options with the first Graphics Object (trajectory):

profile := 
  ParametricPlot[\[Beta][t], {t, 0, 
  Evaluate[Roll[4*length1, B]][[1]]}, PlotRange -> All, 
  Axes -> False, Background -> GrayLevel[0.9]];
gen[s_] := 
  ParametricPlot[Evaluate[ff[t, s]], {t, 0, 2*Pi}, PlotRange -> All, 
  PlotStyle -> {{Thickness[0.005], Darker[Green]}}, Axes -> False, 
  Background -> GrayLevel[0.9]];
trajectory := 
  Evaluate[ParametricPlot[Evaluate[Roll[s, B]], {s, 0, 2*length1}, 
  PlotStyle -> {{Thickness[0.008], Purple}}, Axes -> False, 
  PlotPoints -> 100, ImageSize -> {300, 300}, 
  PlotRange -> {{-b1, 2*length1 + b1}, {-0.6, 2*b1 + 0.6}}]];
contactPoint[s_] := 
  Graphics[{Red, PointSize[0.025], Point[\[Beta][s]]}, 
  Background -> GrayLevel[0.9]];
trajectoryPoint[s_] := 
  Graphics[{Purple, PointSize[0.025], Point[Roll[s, B]]}, 
  Background -> GrayLevel[0.9]];
FG[s_] := 
  Show[trajectory, gen[s], trajectoryPoint[s], profile, 
  contactPoint[s]];
Animate[FG[s], {s, 0, 2*length1}]
$\endgroup$
  • $\begingroup$ Wow, thanks a lot. This workaround is totally acceptable, but I find it very odd that Mathematica's errors didn't really address the options. $\endgroup$ – rubik Apr 21 '17 at 8:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.