1 import matplotlib.pyplot as plt 2 import numpy as np 3 4 x = np.linspace(-3, 3, 50) 5 y1 = 2 * x + 1 6 7 #figure 1 8 plt.figure() 9 plt.plot(x, y1, linewidth = 10,zorder=1) 10 11 12 #横纵坐标轴显示范围设置 13 plt.xlim((-2, 2)) 14 plt.ylim((-10, 10)) 15 16 #坐标轴的移动 gca = “get current axis” 17 ax = plt.gca() 18 ax.spines["right"].set_color("none") 19 ax.spines["top"].set_color("none") 20 ax.xaxis.set_ticks_position("bottom") 21 ax.yaxis.set_ticks_position("left
matplotlib(4)-- 数据覆盖坐标轴时的相关处理、散点图scatter、条形图bar
最新推荐文章于 2022-11-18 15:53:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)