Python 2.7.9中如何修改canvas using "Turtle"的坐标设置?

How do I modify the settings of the coordinates of the canvas using "Turtle" in Python 2.7.9?

我想让我的乌龟在 y=(-1, 1) 的范围内画一条正弦曲线。 它工作正常,但绘图的尺寸非常小。如果我将 y 乘以 50,它看起来很不错,但我的任务是表示 y=(-1, 1),所以乘以 y 值不是一个选项。

我想修改 canvas 的显示设置,例如y=(-1, 1) 应该是 300px。我希望你明白我的意思。预先感谢您的帮助!

Here is my code so far.

y = 50*(math.sin(math.radians(x)))

with x in the range from min to max 当然会产生相应的图,if (min,max)=(0,300) then from sin(0) to sin(300*pi/180).

(x-min)/(max-min)

会产生一个0到1范围内的变量

-1+2*(x-min)/(max-min)

对应-1到1范围内的变量

所以你想要的是

y = 50*(math.sin(-1+2*(x-min)/(max-min)))

评论后更新:为什么不设置unit=150,这样,使用典型的屏幕坐标,可以直接使用y=math.sin(x)

或设置用户坐标系

(lower left upper right)=(-1.2 -1.2 1.2 1.2 )