Python图形的困难

Python图形的困难,python,graph,Python,Graph,这是我目前正在运行的脚本;没有错误,但结果应该是一个圆形图,而不是我得到的半圆-感谢任何帮助 import math import numpy as np import matplotlib.pyplot as plt %pylab inline # max = maximum principal stress # min = minimum principal stress # x_norm = normal stress in x-direction # y_norm = normal s

这是我目前正在运行的脚本;没有错误,但结果应该是一个圆形图,而不是我得到的半圆-感谢任何帮助

import math
import numpy as np
import matplotlib.pyplot as plt
%pylab inline

# max = maximum principal stress
# min = minimum principal stress
# x_norm = normal stress in x-direction
# y_norm = normal stress in y-direction
# t = shear stress

x_norm = -60
y_norm = 50
t = 50

R = math.sqrt(((x_norm - y_norm)/2)**2 + t**2)
print 'The radius of the circle is         '+str(R)

max = int((x_norm + y_norm)/2 + R)
min = int((x_norm + y_norm)/2 - R)
print 'The maximum stress is               ' +str(max)
print 'The minimum stress is              ' +str(min)

theta = 0.5 * math.atan((2*t)/(x_norm - y_norm))
print 'The angle rotation of the block is ' +str(theta)

aver = (x_norm + y_norm)/2
print 'The average shear stress is        ' +str(aver)

x = np.linspace(min, max, 1000)
y = np.sqrt((R**2) - ((x-aver)**2))

plt.axis([-100, 100, -100, 100])

plt.plot(x,y)
plt.show()

你忘了什么。取x**2=y。x=sqrty确实是一个解决方案,但。。。这不是唯一的一个!我添加了plt.plotx,-y,它创建了圆的另一侧,但两个半圆不完全相交。你知道我如何改变我的脚本,这样它就可以为整个循环写一个等式或其他东西吗?谢谢