Ask Your Question

Plots: display period information

asked 2015-07-10 22:32:46 +0200

mellow_yellow gravatar image

updated 2015-07-10 23:23:33 +0200

Disclaimer: I'm new to Sage.

Is it possible to indicate the period when plotting periodic functions?

According to my trig book, for example, "you have a graph that has four complete cycles of the sine curve in the space where you would usually find one", as shown here:


Is there a way to indicate each period? If not, could I approximate it with ticks? Something like:

P=points([(pi,0),(2*pi,0)], pointsize=40, color='red')
P+plot(f(x),(x,-2*pi,2*pi), ticks=pi/2, tick_formatter=pi)
edit retag flag offensive close merge delete


I'm not sure what about your solution isn't what you want. You can specify arbitrary ticks and the format you chose is correct... maybe I'm not sure exactly what you mean by "indicate the period".

kcrisman gravatar imagekcrisman ( 2015-07-11 00:01:31 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-07-11 23:55:40 +0200

ndomes gravatar image

You can create a list of points indicating the periods. (I use list comprehension. )

P=points([(k*pi/2,0) for k in [-4..4]], pointsize=40, color='red')
P+plot(f(x),(x,-2*pi,2*pi), ticks=pi/2, tick_formatter=pi)
edit flag offensive delete link more



Perfect! It didn't occur to me to use a list comprehension.

mellow_yellow gravatar imagemellow_yellow ( 2015-07-13 18:04:20 +0200 )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


Asked: 2015-07-10 22:32:46 +0200

Seen: 719 times

Last updated: Jul 11 '15