Python 如何在matplotlib图表中的x轴下方添加徽标
我想使用matplotlib将徽标添加到图表的右下角 我的徽标没有安装在正确的位置 我的徽标源=”https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png" 在jupyter笔记本中,徽标就像一面镜子。Python 如何在matplotlib图表中的x轴下方添加徽标,python,matplotlib,Python,Matplotlib,我想使用matplotlib将徽标添加到图表的右下角 我的徽标没有安装在正确的位置 我的徽标源=”https://raw.githubusercontent.com/cldougl/plot_images/add_r_img/vox.png" 在jupyter笔记本中,徽标就像一面镜子。 @importanceofbeingernest我想在x轴下方添加徽标,而不是在绘图区域。所有可用的答案都在内部绘图中显示徽标。如果图像在轴内或轴外,则实际上没有太大差异。也考虑一下。如果这些都没有帮助,请问
@importanceofbeingernest我想在x轴下方添加徽标,而不是在绘图区域。所有可用的答案都在内部绘图中显示徽标。如果图像在轴内或轴外,则实际上没有太大差异。也考虑一下。如果这些都没有帮助,请问一个问题,你在哪里展示了你的尝试,以及失败的程度。@ImportanceOfBeingErnest我已经添加了我的输出。我的徽标没有正确显示。你能告诉我怎样修理吗。提前谢谢!徽标位于图形外部。使用
0
或更高版本,而不是在该位置使用-25
。如果需要为徽标留出更多空间,请调整子地块位置,例如plt.subplot\u adjust(bottom=0.3)
@ImportanceOfBeingErnest如何更改徽标大小和位置。?
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))