1 from matplotlib.pyplot import * 2 x = [1, 2, 3, 4] 3 y = [5, 4, 3, 2] 4 5 figure() 6 subplot(231) 7 plot(x,y) 8 9 subplot(232) 10 bar(x,y) 11 12 subplot(233) 13 barh(x,y) 14 15 subplot(234) 16 bar(y,x) 17 18 y1= [7, 8, 5, 3] 19 bar(x, y1, bottom=y, color=‘r‘) 20 subplot(235) 21 boxplot(x) 22 23 subplot(236) 24 scatter(x,y) 25 26 show()
时间: 2024-12-06 02:00:26