python - 如何在 matplotlib 图表的 x 轴下方添加徽标
问题描述
我想使用 matplotlib 在图表的右下角添加徽标。
我的标志不适合在正确的位置。
我的标志来源="https://raw.githubusercontent.com/cldougl/plot_images/add_r_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))
解决方案
推荐阅读
- git - 提交到 Android Studio 中的 2 个不同的 Github 存储库
- xamarin.forms - Xamarin Forms CustomLabel 在 iOS 中崩溃
- python - 计算用户有多少帖子
- python - 将列值转换为行并根据另一列的值对它们进行分组
- arrays - VB:在尝试将 csv 读入数据网格时索引数组边界之外
- intellij-idea - Intellij Idea - 完成下一个参数快捷方式
- c# - 发生动作时如何重叠 2 个游戏对象并让顶部的游戏对象消失。Unity C#
- ios - 将角点扭曲为具有给定纵横比的矩形 2D 图像的四边形
- php - 如何在 CodeIgniter 中使用 OR_Where 和 AND 条件?
- php - com.android.vending.INSTALL_REFERRER