Cambiar el estilo de trazado como función del parámetro en ParametricPlot

Sep 13 2020

Lo Manipulatesiguiente produce una trayectoria que atraviesa el semicírculo de la unidad superior, pasando del {1,0}tiempo 0 al {-1,0}tiempo 1/2, luego atraviesa el mismo semicírculo superior, pero en la dirección inversa, volviendo desde el {-1,0}tiempo 1/2 al {1,0}tiempo 1.

Sin embargo, no se puede "ver" la mitad inversa del camino, ya que se encuentra en la parte superior del mismo semicírculo, pero atravesado en la dirección inversa, de la mitad delantera.

¿Es posible usar una PlotStyle, u otra directiva, para cambiar el estilo de la curva en el tiempo 1/2 de modo que, por ejemplo, la trama a partir de ese momento sea más gruesa y de un color diferente?

f[t_ /; 0 <= t <= 1/2] := ReIm[Exp[2 \[Pi] I t]]
f[t_ /; 1/2 < t <= 1] := ReIm[Exp[2 \[Pi] I (1 - t)]]

Manipulate[
 ParametricPlot[f[t], {t, 0, v}, 
  PlotRange -> {{-1, 1}, {-1, 1}}], {{v, 0.01}, 0.01, 1}]

(Me doy cuenta de que hay una forma de falsificar el resultado que quiero, es decir, cambiando la función fen el intervalo medio {1/2, 1}para tener un radio ligeramente mayor que 1. Pero preferiría dejar el radio sin cambios y "simplemente "cambie el estilo del grosor y / o color de la curva en ese medio intervalo).

Respuestas

3 BobHanlon Sep 13 2020 at 02:01
Clear["Global`*"]

f[t_ /; 0 <= t <= 1/2] := ReIm[Exp[2 \[Pi] I t]]
f[t_ /; 1/2 < t <= 1] := ReIm[Exp[2 \[Pi] I (1 - t)]]

Podrías usar ColorFunction

EDITAR:

Manipulate[
 ParametricPlot[f[t], {t, 0, v},
  PlotRange -> {{-1, 1}, {-1, 1}},
  ColorFunction -> (If[#3 < 1/2, Blue, Red] &),
  ColorFunctionScaling -> False],
 {{v, 0.01}, 0.01, 1, 0.01, Appearance -> "Labeled"}]
3 MichaelE2 Sep 13 2020 at 04:20

La gráfica de una sola función sin singularidades dará como resultado un solo Lineobjeto, que solo puede tener un solo grosor. Para obtener dos espesores, necesitaría dibujar dos líneas. Esto puede ser aceptable o no, ya que no parece una función única.

Ya sea

Manipulate[
 ParametricPlot[{
   Style[ConditionalExpression[f[t], t <= 1/2], AbsoluteThickness[1], Blue],
   Style[ConditionalExpression[f[t], t >= 1/2], AbsoluteThickness[3], Red]},
  {t, 0, v},
  PlotRange -> {{-1, 1}, {-1, 1}},
  PlotRangePadding -> Scaled[0.01]],
 {{v, 0.01}, 0.01, 1, 0.01, Appearance -> "Labeled"}]

o

Manipulate[
 ParametricPlot[{
   ConditionalExpression[f[t], t <= 1/2],
   ConditionalExpression[f[t], t >= 1/2]},
  {t, 0, v},
  PlotRange -> {{-1, 1}, {-1, 1}},
  PlotStyle -> {
    Directive[AbsoluteThickness[1], Blue],
    Directive[AbsoluteThickness[3], Red]},
  PlotRangePadding -> Scaled[0.01]],
 {{v, 0.01}, 0.01, 1, 0.01, Appearance -> "Labeled"}]
1 kglr Sep 13 2020 at 07:07

También se puede utilizar MeshFunctions, Meshy MeshShadinglas opciones de la siguiente manera:

Manipulate[ParametricPlot[f[t], {t, 0, v}, 
   MeshFunctions -> {#3 &}, 
   Mesh -> {{1/2}}, 
   MeshStyle -> None, 
   MeshShading -> {Directive[CapForm["Butt"], AbsoluteThickness[7], Blue], 
      Directive[CapForm["Butt"], AbsoluteThickness[4], 
         Dashing[{Large, Medium}], Red]}, 
   PlotRange -> {{-1, 1}, {-1, 1}} 1.1],
 {{v, 0.01}, 0.01, 1}]

Utilizar

MeshShading -> {Directive[AbsoluteThickness[1], Blue], 
     Directive[AbsoluteThickness[7], Dashing[{Large, Medium}], Opacity[.5, Red]]}

Llegar

SteffenJaeschke Sep 13 2020 at 01:02
f[t_ /; 0 <= t <= 1/2] := ReIm[Exp[2 π I t]]
f[t_ /; 1/2 < t <= 1] := ReIm[Exp[2 π I (1 - t)]]

Manipulate[
 ParametricPlot[f[t], {t, 0, v}, PlotRange -> {{-1, 1}, {-1, 1}}, 
  ColorFunction -> Function[{t}, If[t > 1/4, Blue, Black]], 
  ColorFunctionScaling -> False], {{v, 0.01}, 0.01, 1}]

Manipulate[
 ParametricPlot[f[t], {t, 0, v}, PlotRange -> {{-1, 1}, {-1, 1}}, 
  PlotStyle -> If[v > 1/4, {Blue, Bold}, {Black, Dashed}]], {{v, 
   0.01}, 0.01, 1}]