Ask Your Question

Revision history [back]

The first part is easy:

beta = 1/50
P = line([(-0.5, 0), (0.5, 0)])
for i in range(-5, 6):
    P += point((beta + i/11, 0))

tikz is good at letting you position labels well, whereas Sage does not have anything like that built in: you have to place them manually. Do that with the text command. I did not have the patience to come up with anything that looked remotely good, so I have not included that, but you would do P += text("string", (x, y)). The same goes for curved lines connecting points, although you can try to use spline to do that:

for i in range(-5, 2):
    P += plot(spline([(beta + i/11, 0), (beta + (2*i+1)/22, 0.05), (beta + (i+1)/11, 0)]), (beta+i/11, beta+(i+1)/11))
P += plot(spline([(beta - 2/11, 0), (beta - 1, 0), (beta - (1/2 + 2/22), -0.05)]), (beta-1, beta-2/11))
P += plot(spline([(beta - 1, 0), (beta/2 - 1/2, -0.05), (0,0)]), (beta-1, 0))

Then you can adjust the aspect ratio to get it to look how you want:

P.set_aspect_ratio(2)