Altair 的图像未显示 mark_image url

Image not showing for Altair mark_image url

我正在尝试用我自己的图像重现此示例,但图像不显示。我将示例中的第三张图片替换为我自己上传到 public 存储库中的 github 的图片。我之前曾尝试使用 google 云存储桶中的图像,但也没有用。我还用 link 将第二张图片替换为库存图片,并且该图片有效。我错过了什么?

import altair as alt
import pandas as pd

source = pd.DataFrame.from_records([
      {"x": 0.5, "y": 0.5, "img": "https://vega.github.io/vega-datasets/data/ffox.png"},
      {"x": 1.5, "y": 1.5, "img": "https://media.istockphoto.com/photos/sunflower-isolated-picture-id174648035"},
      {"x": 2.5, "y": 2.5, "img": "https://github.com/flbyrne/images/blob/main/snowman.png"}
])

alt.Chart(source).mark_image(
    width=50,
    height=50
).encode(
    x='x',
    y='y',
    url='img'
)

您需要使用原始 GitHub link(右键单击图像并在新选项卡中打开它):

https://raw.githubusercontent.com/flbyrne/images/main/snowman.png

而不是

https://github.com/flbyrne/images/blob/main/snowman.png