1.使用matplotlib在坐标轴中添加文字和折线

代码:

# -*- coding: utf-8 -*-
"""
Created on Wed May 15 16:09:55 2019
@author: mzl
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
# 在图中可以添加基本元素[文字]
# =============================================================================
# plt.figure()
# plt.text( 0.5, 0.5, 'Figure', ha='center',
#           va='center', size=20, alpha=.5 )
# plt.xticks([]), plt.yticks([])
# plt.show()
# =============================================================================


# 在图中可以添加基本元素[文字]
# =============================================================================
from PIL import Image
plt.figure()
plt.xticks([]), plt.yticks([])
im = np.array(Image.open('Houston Rockets.png'))
plt.imshow(im)
plt.show()
# =============================================================================
# 在图中可以添加基本元素「折线」
plt.figure()
plt.plot( [0,1],[0,1] )
plt.show()

结果:

matplotlib中添加元素

matplotlib中添加元素

 

相关文章:

  • 2021-05-19
  • 2022-01-09
  • 2022-12-23
  • 2021-05-25
  • 2021-12-21
  • 2022-12-23
  • 2021-12-31
  • 2022-02-09
猜你喜欢
  • 2021-07-23
  • 2021-11-12
  • 2021-12-18
  • 2022-12-23
  • 2022-01-24
相关资源
相似解决方案