如何使用python绘制多个图在一个窗口

代码部分

import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(1,3,1)
x = np.linspace(-1,1,300)[:,np.newaxis]
y = np.linspace(-1,1,300)[:,np.newaxis]

[ax1, ax2, ax3] , [ax4, ax5, ax6] = fig.subplots(2, 3, sharey=True)
ax1.plot(x, y)
ax1.set_title(‘Sharing Y axis’)
ax2.scatter(x, y)
plt.show()

效果如图

如何使用python绘制多个图在一个窗口

相关文章:

  • 2021-07-16
  • 2021-12-27
  • 2021-06-11
  • 2021-10-15
  • 2021-12-02
  • 2022-01-28
  • 2022-02-18
  • 2022-02-09
猜你喜欢
  • 2021-10-05
  • 2021-07-16
  • 2021-07-27
  • 2021-10-28
  • 2022-12-23
  • 2021-07-09
相关资源
相似解决方案