如何在matplotlib图表的x轴下方添加徽标

2024-04-28 23:02:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用matplotlib在图表的右下角添加徽标。你知道吗

我的商标不合适。你知道吗

我的徽标源=“https://raw.githubusercontent.com/cldougl/plot\u images/add\r\u img/vox.png““

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as image
import matplotlib.pyplot as plt#
from matplotlib.offsetbox import  OffsetImage
fig, ax = plt.subplots()
logo=image.imread("https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png")
# You have to add your own logo, this is in my own folder
addLogo = OffsetImage(logo, zoom=0.4)
#addLogo.set_zorder(100)
addLogo.set_offset((250,-25)) # pass the position in a tuple
ax.add_artist(addLogo)
height = [6, 10, 5, 18, 45]
bars = ('A', 'B', 'C', 'D', 'E')
y = np.arange(len(bars))
plt.bar(y, height, color=(0.2, 0.4, 0.6, 0.6))

enter image description here

在jupyter笔记本的标志就像镜子。 enter image description here


Tags: httpsimageimportcomaddrawplotmatplotlib