# -*- coding: utf-8 -*-
"""
Created on Thu Oct 11 16:05:52 2018
@author: Administrator
"""
'''
绘制默认sin曲线图
'''
#设置x,y的值
import numpy as np
x = np.linspace(0 , 4*np.pi) #x为0~4π
y = np.sin(x) #y为sin(x)
#绘图
import matplotlib.pyplot as plt
plt.plot( x , y , label="$sin(x)$" )
plt.title('sin')
#保存并展示图片
plt.savefig('./sin(x).png')
plt.show()
修改显示的曲线的线条
#设置x,y的值
import numpy as np
x = np.linspace(0 , 4*np.pi) #x为0~4π
y = np.sin(x) #y为sin(x)
#绘图
import matplotlib.pyplot as plt
#修改线条
plt.rcParams['lines.linestyle'] = '-.'
plt.rcParams['lines.linewidth'] = 3
plt.plot( x , y , label="$sin(x)$" )
plt.title('sin')
#保存并展示图片
plt.savefig('./sin(x).png')
plt.show()