![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
matplotlib
吃饭第一名~
这个作者很懒,什么都没留下…
展开
-
左右纵坐标轴
import numpy as npfrom mpl_toolkits.axisartist.parasite_axes import HostAxes, ParasiteAxesimport matplotlib.pyplot as pltimport matplotlib as mplmpl.rcParams["font.sans-serif"] = ["Times New Roman"]mpl.rcParams["axes.unicode_minus"] = Falsex = ['0',原创 2021-07-14 21:20:04 · 391 阅读 · 1 评论 -
Python绘制流程图
欢迎大神尝试import matplotlib.pyplot as pltimport numpy as npimport matplotlib.patches as mpatchesplt.subplots_adjust(left=0.00, bottom=0.0, right=1.00, top=0.95, wspace=0.0, hspace=0.00)def hexagon_...原创 2020-03-15 00:48:24 · 7682 阅读 · 1 评论 -
matplotlib淘汰折线图
import numpy as npimport matplotlib.pyplot as pltimport matplotlib as mplmpl.rcParams["font.sans-serif"] = ["KaiTi"]mpl.rcParams["axes.unicode_minus"] = Falsex=[1,2,3,4,5,6,7,8,9,10,11]y=[60, 61, 63, 61, 62, 68, 60, 64, 60, 63, 60]fig=plt.figure(f原创 2021-06-10 12:53:16 · 163 阅读 · 0 评论 -
matplotlib柱状图与标准线
import numpy as npimport matplotlib.pyplot as pltimport matplotlib as mplimport seaborn as snsmpl.rcParams["font.sans-serif"] = ["SimHei"]mpl.rcParams["axes.unicode_minus"] = Falsey1=0.48y2=0.46y3=0.47y4=0.45y5=0.46x1=0x2=1x3=2x4=3x5=4ba原创 2021-06-09 21:54:11 · 1166 阅读 · 0 评论 -
matplotlib折线图与柱状图绘制在一起
import seaborn as snsimport matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = ['SimHei'] # 中文字体设置-黑体plt.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题sns.set(font='SimHei', style='white', ) # 解决Seaborn中文显示问题Income=[2456,203原创 2021-06-08 16:44:31 · 2408 阅读 · 1 评论 -
matplotlib多张子图画在一起
import matplotlib.pyplot as pltimport numpy as npimport mathplt.rcParams['font.sans-serif']=['SimHei'] # 用来正常显示中文标签plt.rcParams['axes.unicode_minus']=False # 用来正常显示负号x = np.linspace(-math.pi, math.pi)y1 = np.sin(x)y2 = np.cos(x)y3 = np.tan(x)fig原创 2021-06-08 16:42:48 · 1336 阅读 · 0 评论 -
python绘制单列多色柱状图
import pandas as pddfA = pd.read_excel('E:/画图/WashingMachine.xlsx')dtdA = pd.to_datetime(dfA['价格'], infer_datetime_format=True)month1 = dfA[(pd.to_datetime(dfA['价格'], infer_datetime_format=True) >= pd.to_datetime(0, infer_datetime_format=True))原创 2021-05-24 15:05:54 · 824 阅读 · 0 评论 -
Python绘制气泡图
实现python绘制气泡图,用气泡的不同颜色,不同大小展示信息代码部分import numpy as npimport pandas as pdimport seaborn as snsimport matplotlib.pyplot as pltimport matplotlib.pyplot as pltfrom matplotlib.pyplot import MultipleLocatordef DrawBubble(read_name):#气泡图 sns.set(styl原创 2021-04-28 16:33:36 · 3923 阅读 · 1 评论 -
python实现相关系数热力图
Python实现import seaborn as snsimport numpy as npimport matplotlib.pyplot as pltimport randomnp.random.seed(1)data = np.random.rand(8, 8)sns.set()# data:数据 square:是否是正方形 vmax:最大值 vmin:最小值 robu...原创 2020-03-16 14:43:50 · 3458 阅读 · 0 评论 -
Python绘制雷达图
import matplotlibimport matplotlib.pyplot as pltimport numpy as npmatplotlib.rcParams['font.family'] = 'SimHei'matplotlib.rcParams['font.sans-serif'] = ['SimHei'] # 为了正确显示中文字体,将字体更改为黑体‘SimHei’d...原创 2020-03-16 14:33:11 · 2938 阅读 · 0 评论 -
Python绘制彩虹饼图
from matplotlib import font_manager as fmfrom matplotlib import cmimport matplotlib.pyplot as pltimport pandas as pdimport numpy as npshapes = ['Cross', 'Cone', 'Egg', 'Teardrop', 'Chevron', 'Di...原创 2020-03-16 14:28:19 · 1660 阅读 · 0 评论 -
python三个并排饼图
import matplotlib.pyplot as pltlabels = 'Comments rated 1', 'Comments rated 2', 'Comments rated 3', 'Comments rated 4', 'Comments rated 5'sizes = [38, 16, 18, 54, 107]sizes1 = [84, 45, 59, 132, 31...原创 2020-03-16 14:25:02 · 3477 阅读 · 0 评论 -
用Python绘制不一样的柱状图
带有背景的五列柱状图import numpy as npimport matplotlib.pyplot as pltimport matplotlib as mplimport seaborn as snssns.set(color_codes=True)mpl.rcParams["font.sans-serif"] = ["SimHei"]mpl.rcParams["axes....原创 2020-03-16 14:18:05 · 882 阅读 · 0 评论 -
Python绘图之折线图
带有虚线背景的折线图from pylab import *mpl.rcParams['font.sans-serif'] = ['SimHei']x=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]y=[900, 1080, 1800, 3060,...原创 2020-03-15 00:54:06 · 1489 阅读 · 0 评论 -
Python绘制横向左右柱形图
直接上代码import numpy as npimport matplotlib.pyplot as pltfrom pylab import *mpl.rcParams['font.sans-serif'] = ['SimHei']x = np.array([8021, 7577, 7118, 7518, 10029, 12850, 10146, 9724, 11771, 12391...原创 2020-03-15 00:52:03 · 6236 阅读 · 1 评论 -
Python多项式拟合并绘制折线图
多项式拟合并绘制折线图并打印出拟合多项式直接上代码from pylab import *mpl.rcParams['font.sans-serif'] = ['SimHei']mpl.rcParams["font.sans-serif"] = ["SimHei"]mpl.rcParams["axes.unicode_minus"] = Falsex = [1, 2, 3, 4, 5,...原创 2020-03-15 00:41:45 · 846 阅读 · 0 评论 -
Python画图之饼图
Python画图之饼图import matplotlib.pyplot as pltplt.rcParams['font.sans-serif'] = 'SimHei' # 设置中文显示plt.figure(figsize=(5, 5)) # 将画布设定为正方形,则绘制的饼图是正圆label = ['否', '是'] # 定义饼图的标签,标签是列表explode = [0.01, ...原创 2020-03-15 00:13:51 · 1800 阅读 · 0 评论 -
matplotlib画图之柱状图
matpltlib画图之柱状图1. 三列柱状图import numpy as npimport matplotlib as mplimport matplotlib.pyplot as pltmpl.rcParams["font.sans-serif"] = ["SimHei"]mpl.rcParams["axes.unicode_minus"] = Falsesize = 3x...原创 2020-03-14 19:14:29 · 2554 阅读 · 0 评论