Ask Your Question
2

xmin and xmax doesn't work within parametric plot.

asked 2021-04-18 04:58:43 +0100

debojit2178 gravatar image

updated 2021-04-18 04:59:12 +0100

Restricting the range with xmin and xmax doesn't work with parametric plot. Here's the code,

cs_01 = parametric_plot([fresnel_cos(t), fresnel_sin(t)], (t, -1.5*pi, 1.5*pi), ticks=[pi/8, 0.2], tick_formatter=[pi, None], axes_labels=['$x(t)$', '$y(t)$'], axes_labels_size=1.5, plot_points=500, xmin=-pi/4, xmax=pi/4, ymin=-0.8, ymax=0.8, fontsize=12)
cs_01_text_01 = text(r'$x(t) = \int_0^t\cos(\frac{\pi u^2}{2})du$', (-pi/2,0.8), fontsize=13, color='black', bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'})
cs_01_text_02 = text(r'$y(t) = \int_0^t\sin(\frac{\pi u^2}{2})du$', (-pi/2,0.4), fontsize=13, color='black', bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'})
cs_01_text_03 = text('Clothoid or Cornu spiral', (0, 1.15), fontsize=14, color='black', fontweight='bold')
cs_01 + cs_01_text_01 + cs_01_text_02 + cs_01_text_03

But when provided within show it works,

cs_01 = parametric_plot([fresnel_cos(t), fresnel_sin(t)], (t, -1.5*pi, 1.5*pi), ticks=[pi/8, 0.2], tick_formatter=[pi, None], axes_labels=['$x(t)$', '$y(t)$'], axes_labels_size=1.5, plot_points=500, ymin=-0.8, ymax=0.8, fontsize=12) + \
text(r'$x(t) = \int_0^t\cos(\frac{\pi u^2}{2})du$', (-pi/2,0.8), fontsize=13, color='black', bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'}) + \
text(r'$y(t) = \int_0^t\sin(\frac{\pi u^2}{2})du$', (-pi/2,0.4), fontsize=13, color='black', bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'}) + \
text('Clothoid or Cornu spiral', (0, 1.15), fontsize=14, color='black', fontweight='bold')
cs_01.show(xmin=-pi/4, xmax=pi/4)

I don't know why it's happening. Is it supposed to work like that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-04-18 11:44:22 +0100

tmonteil gravatar image

You have to add xmin=-pi/4, xmax=pi/4 to one of the the text pictures you are adding with the parametric_plot e.g.:

cs_01 = parametric_plot([fresnel_cos(t), fresnel_sin(t)], (t, -1.5*pi, 1.5*pi), ticks=[pi/8, 0.2], tick_formatter=[pi, None], axes_labels=['$x(t)$', '$y(t)$'], axes_labels_size=1.5, plot_points=500, xmin=-pi/4, xmax=pi/4, ymin=-0.8, ymax=0.8, fontsize=12)
cs_01_text_01 = text(r'$x(t) = \int_0^t\cos(\frac{\pi u^2}{2})du$', (-pi/2,0.8), fontsize=13, color='black', xmin=-pi/4, xmax=pi/4, bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'})
cs_01_text_02 = text(r'$y(t) = \int_0^t\sin(\frac{\pi u^2}{2})du$', (-pi/2,0.4), fontsize=13, color='black', bounding_box={'boxstyle':'round', 'fc':(0.9,0.9,0.9), 'ec':'w'})
cs_01_text_03 = text('Clothoid or Cornu spiral', (0, 1.15), fontsize=14, color='black', fontweight='bold')
cs_01 + cs_01_text_01 + cs_01_text_02 + cs_01_text_03

I would say there is a wrong design somewhere.

edit flag offensive delete link more

Comments

Ok, that does the job. Thanks. But why it doesn't work with the parametric plot?

debojit2178 gravatar imagedebojit2178 ( 2021-04-18 12:29:46 +0100 )edit
1

It does, if you let the plot alone:

cs_01 = parametric_plot([fresnel_cos(t), fresnel_sin(t)], (t, -1.5*pi, 1.5*pi), ticks=[pi/8, 0.2], tick_formatter=[pi, None], axes_labels=['$x(t)$', '$y(t)$'], axes_labels_size=1.5, plot_points=500, xmin=-pi/4, xmax=pi/4, ymin=-0.8, ymax=0.8, fontsize=12)
cs_01

There is an interplay when you add the plots together.

tmonteil gravatar imagetmonteil ( 2021-04-18 13:33:00 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-04-18 04:58:43 +0100

Seen: 313 times

Last updated: Apr 18 '21