找到 1 篇文章 关于 CherryPy

参数“c”和“cmap”在 Matplotlib 散点图中如何表现?

Rishikesh Kumar Rishi
更新于 08-Jul-2021 11:15:04

1K+ 浏览

为了了解参数 c 和 cmap 在 Matplotlib 散点图中的表现,我们可按以下步骤进行操作:- 设置图片大小并调整子图之间的间距。初始化变量 N 来存储样本数据的数量。使用 numpy 创建 x 和 y 数据点。使用 scatter() 方法绘制 x 和 y 数据点,加上颜色和颜色映射。使用 show() 方法显示图形。示例import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 50 x = np.random.randn(N) y = np.random.randn(N) plt.scatter(x, y, c=x, ... 阅读更多

1
广告
© . All rights reserved.