合集-matplotlib

摘要:示例 1 # 0. 导入依赖包 2 import matplotlib.pyplot as plt 3 import random 4 # 1. 准备数据即x,y坐标轴的数据 5 x = range(60) 6 y_nj = [random.uniform(15,18) for i in x] 7 阅读全文
posted @ 2023-11-26 13:51 Allen_Hao 阅读(46) 评论(0) 推荐(0) 编辑
摘要:Matplotlib 简介 Matplotlib 是一个用于绘制图表和可视化数据的 Python 库,由 John D. Hunter 于 2003 年创建。 它提供了广泛的绘图功能,适用于科学计算、数据分析、机器学习等领域。Matplotlib 是一个开源项目,广泛应用于科研、教育和工程等领域。 阅读全文
posted @ 2023-11-25 21:37 Allen_Hao 阅读(432) 评论(0) 推荐(0) 编辑
摘要:Matplotlib 是一个用于绘制图表和数据可视化的 Python 库。它支持多种不同类型的图形,以满足各种数据可视化需求。以下是一些 Matplotlib 支持的主要图形种类: 折线图(Line Plot): 用于显示数据随时间或其他连续变量的变化趋势。 特点:能够显示数据的变化趋势,反映事物的 阅读全文
posted @ 2023-11-27 23:49 Allen_Hao 阅读(139) 评论(0) 推荐(0) 编辑
摘要:# 0. 导入依赖包 import matplotlib.pyplot as plt import random # 1. 准备数据即x,y坐标轴的数据 x = range(60) y_nj = [random.uniform(15,18) for i in x] # 2. 创建画布 plt.fig 阅读全文
posted @ 2023-11-28 00:09 Allen_Hao 阅读(162) 评论(0) 推荐(0) 编辑
摘要:在Matplotlib库中,mpl.rcParams 是一个字典,用于配置Matplotlib的默认参数。通过修改这些参数,你可以自定义图形的外观和行为。 1. 字体相关设置: font.family: 字体系列,默认为 "sans-serif"。 font.sans-serif: 无衬线字体,用于 阅读全文
posted @ 2023-11-28 23:14 Allen_Hao 阅读(152) 评论(0) 推荐(0) 编辑
摘要:matplotlib 中的 xticks 函数用于设置坐标轴的刻度和标签,包括位置和显示的文本标签。 matplotlib.pyplot.xticks(ticks=None, labels=None, **kwargs) ticks: 刻度位置,可以是一个列表或数组。 labels: 刻度对应的标签 阅读全文
posted @ 2023-11-29 20:22 Allen_Hao 阅读(45) 评论(0) 推荐(0) 编辑
摘要:matplotlib 中的 yticks 函数用于设置坐标轴的刻度和标签,包括位置和显示的文本标签。 matplotlib.pyplot.yticks(ticks=None, labels=None, **kwargs) ticks: 刻度位置,可以是一个列表或数组。 labels: 刻度对应的标签 阅读全文
posted @ 2023-11-29 20:41 Allen_Hao 阅读(182) 评论(0) 推荐(0) 编辑
摘要:matplotlib 中的 grid 函数用于在图表上添加网格线 grid 函数 matplotlib.pyplot.grid(b=None, which='major', axis='both', **kwargs) b: 布尔值,表示是否显示网格。如果为 True,则显示网格;如果为 False 阅读全文
posted @ 2023-11-29 20:56 Allen_Hao 阅读(268) 评论(0) 推荐(0) 编辑
摘要:xlabel xlabel 函数用于为 Matplotlib 图表添加 x 轴的标签 xlabel 函数 matplotlib.pyplot.xlabel(xlabel, fontdict=None, labelpad=None, **kwargs) xlabel: 字符串,表示 x 轴标签的文本内 阅读全文
posted @ 2023-11-29 21:25 Allen_Hao 阅读(1150) 评论(0) 推荐(0) 编辑
摘要:savefig函数 Matplotlib中,savefig函数用于保存图形为文件。通过该函数,你可以将绘制的图形保存为常见的图像文件格式,如PNG、JPEG、SVG等。 matplotlib.pyplot.savefig(fname, dpi=None, bbox_inches='tight', p 阅读全文
posted @ 2023-11-29 21:40 Allen_Hao 阅读(1075) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2023-11-29 21:49 Allen_Hao 阅读(16) 评论(0) 推荐(0) 编辑
摘要:3种方式自定义Matplotlib的属性和样式 1. 运行时通过rcParams字典动态设置 2. 使用样式表 3. 更改 matplotlibrc 文件 在运行时设置 rcParams 优先于样式表、样式 工作表优先于文件matplotlibrc即1>2>3 1. 运行时通过rcParams字典动 阅读全文
posted @ 2023-12-02 16:08 Allen_Hao 阅读(137) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示