import numpy as np
import matplotlib.pyplot as pt
x = np.arange(0 , 360,step = 10)
print(x)
y = np.sin( x*np.pi/180.0 )
print(y)
pt.plot(x,y,'ro',color = 'b')
pt.xlim(0,360)
pt.ylim(-1.2,1.2)
pt.title("picture one")
pt.show()
size = 1
x = np.arange(size)
a = np.random.random(size)
b = np.random.random(size)
c = np.random.random(size)
total_width, n = 0.8, 3
width = total_width / n
x = x - (total_width - width) / 2
for i in np.arange(10):
if i <= 5:
pt.bar(x + i*width, i, width=width, label='a',fc = 'b',ec='black')
else:
pt.bar(x + i*width, -i%5, width=width, label='a',fc = 'b',ec='black')
pt.title("picture two")
#pt.bar(x + width, b, width=width, label='b')
#pt.bar(x + 2 * width, c, width=width, label='c')
#pt.legend()
pt.show()
labels = 'Froges', 'Hogs', 'Dogs', 'Logs'
colors = ['yellow','lightskyblue','lightred','orangegreen']
fracs = [15, 30, 45, 10]
explode = [0, 0.1, 0, 0] # 0.1 凸出这部分,
pt.axes(aspect=1) # set this , Figure is round, otherwise it is an ellipse
#autopct ,show percet
pt.pie(x=fracs, labels=labels, explode=explode,autopct='%3.1f %%',
shadow=True, labeldistance=1.1, startangle = 90,pctdistance = 0.6
)
pt.show()