一、Matplotib-绘图和可视化简介

Matplotib是一个强大的Python绘图和数据可视化的工具包

1、安装方法

pip install matplotlib

2、引用方法

import matplotlib.Pyplot as plt

3、绘图函数

plt.plot()

4、显示函数

plt.show()

 二、plot函数

1、导入函数库

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib auto

2、图形单独弹窗

方法一 :自动显示(%matplotlib auto)

plt.plot([1,2,3])

  金融量化分析【day111】:Matplotib简介

方法二、使用显示函数

plt.show()

金融量化分析【day111】:Matplotib简介

 3、二条折线

plt.plot([1,2,3])
plt.plot([4,7,9,13])

  金融量化分析【day111】:Matplotib简介

三、线条类型加颜色

1、线条类型点类型颜色

plt.plot([0,1,2,3],[4,7,9,13],marker='.',linestyle='-',color='#2A3D4F')

金融量化分析【day111】:Matplotib简介

2、标题

plt.plot([1,2,3])
plt.plot([4,7,9,13])
plt.title('Grhhp 1')

  

金融量化分析【day111】:Matplotib简介

3、线型

plt.plot([0,1,2,3],[4,7,9,13],'-')

金融量化分析【day111】:Matplotib简介  

金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介

4、点型

 金融量化分析【day111】:Matplotib简介

plt.plot([0,1,2,3],[4,7,9,13],'^')

金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介

5、颜色

 金融量化分析【day111】:Matplotib简介

plt.plot([0,1,2,3],[4,7,9,13],'H-b')

  

 金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介金融量化分析【day111】:Matplotib简介

 

相关文章:

  • 2021-09-02
  • 2021-11-20
  • 2021-06-14
  • 2022-12-23
  • 2022-01-11
  • 2021-05-28
  • 2021-12-19
  • 2021-12-24
猜你喜欢
  • 2022-01-25
  • 2021-11-29
  • 2021-09-18
  • 2021-07-26
  • 2022-01-06
  • 2022-02-10
  • 2022-01-18
相关资源
相似解决方案