[Python Study Notes]折线图绘制

image

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>>文件: 折线图.py
>>作者: liu yang
>>邮箱: liuyang0001@outlook.com
>>博客: www.cnblogs.com/liu66blog

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
# 定义要使用的字体,防止出现中文乱码
font=matplotlib.font_manager.FontProperties(fname=r"C:\Windows\Fonts\Deng.ttf")

# line chart折线图
def line_chart():
    x=np.linspace(-10,10,100)
    y=x**3
    # 画图
    plt.plot(x,y,linestyle='--',color='g',marker='<')
    plt.title('折线图',fontproperties=font)
    # 显示
    plt.show()

if __name__ == '__main__':
    line=line_chart()
posted @ 2018-03-01 22:15  刘六六  阅读(291)  评论(0编辑  收藏  举报