赞
踩
- import numpy as np
- import matplotlib.pyplot as plt
-
- X=np.arange(-1.5,1.5,0.05)
- Y=np.arange(-1,1.5,0.05)
-
- plt.title('Introduction', fontsize=20)
-
- x,y=np.meshgrid(X,Y)
- # f=17*x**2-16*np.abs(x)*y+17*y**2-225
- f=(x**2+y**2-1)**2*(x**2+y**2-1)-x**2*y**2*y #个人觉得这个好看~
- # fig=plt.figure() #新建一个figure
- plt.xticks([-1.1,0.25,1.15],
- [r'$Playing$',r'$my\ hobby.$',r'$Please\ take\ care\ of\ everything.$'])
- plt.yticks([-1,0,0.4,0.9,1.3],
- [r'$Li\ xiaobai.$',r'$is$',r'$My\ name$',r'$Nice\ to\ meet\ you$',r'$Hello!$'])
- ax=plt.gca()
- ax.spines['right'].set_color('none')
- ax.spines['top'].set_color('none')
- ax.spines['bottom'].set_position(('data',0))
- ax.spines['left'].set_position(('data',0))
-
- cs=plt.contour(x,y,f,0,colors='r')
-
- # x = np.linspace(-1, 1, 200)
- # # 把函数分为上下两个部分
- # y1 = np.sqrt(1-np.power(x, 2)) + np.power(np.square(x), 0.33)
- # y2 = -np.sqrt(1-np.power(x, 2)) + np.power(np.square(x), 0.33)
- # # 设置一下x轴、y轴的刻度和坐标间距
- # # 不自己设置用自动的不好看
- # plt.plot(x, y1, color='r')
- # plt.plot(x, y2, color='r')
-
- plt.show()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。