3
$\begingroup$

Can I label points with numbers in my Graphics expression, as in this picture

enter image description here

Here is my code.

Off[InterpolatingFunction::dmval]

{α, γ, ω} = {0.1, 0.05, 1};

T = (2 π)/ω;

a = NDSolve[{x''[t] - γ (1 - x[t]^2) x'[t] + x[t] == α Cos[ω t], x[0] == 0, x'[0] == 0}, 
      {x, x', ω t}, {t, 0, 700}];

ss[n_] := Table[x[t T] /. a, {t, 0, 100 T}][[n, 1]];

ff[n_] := Table[x'[t T] /. a, {t, 0, 100 T}][[n, 1]];

g1 = ParametricPlot[Evaluate[{x[t], x'[t]} /. a], {t, 0, 100 T}];

g2 = Graphics[Table[{PointSize[Large], Red, Point[{ss[n], ff[n]}]}, {n, 1, 20}]];

Show[{g1, g2}]
$\endgroup$
3
$\begingroup$
Off[InterpolatingFunction::dmval]

{\[Alpha], \[Gamma], \[Omega]} = {0.1, 0.05, 1};

T = (2 \[Pi])/\[Omega];

a = NDSolve[{x''[t] - \[Gamma] (1 - x[t]^2) x'[t] + 
      x[t] == \[Alpha] Cos[\[Omega] t], x[0] == 0, x'[0] == 0}, {x, 
    x', \[Omega] t}, {t, 0, 700}];

ss[n_] := Table[x[t T] /. a, {t, 0, 100 T}][[n, 1]];

ff[n_] := Table[x'[t T] /. a, {t, 0, 100 T}][[n, 1]];

g1 = ParametricPlot[Evaluate[{x[t], x'[t]} /. a], {t, 0, 100 T}];

g2 = Graphics[Table[{PointSize[Large], Red, Point[{ss[n], ff[n]}]}, {n, 1, 20}]];

g3 = Graphics@Table[Text[Style[n, 20], {ss[n] + 0.2, ff[n]}], {n, 1, 20}];

Show[{g1, g2, g3}]

enter image description here

$\endgroup$
3
$\begingroup$

You could add some TextLabels to your plot:

labels = Range[10];
randomPoints = Table[{Random[], Random[]}, {n, 1, 10}];
Show[
Graphics[Table[Text[t, randomPoints[[t]], {2, 0}], {t, 1, 10}]],
Graphics[Table[{PointSize[Large], Red, Point[randomPoints[[t]]]}, {t, 1, 10}]]
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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