Skip to content

How to put User-Defined Image into the scatter diagram #148

@iiiJenny

Description

@iiiJenny

Describe your question

在画散点图时,无法将点的形状设置为自定义图片(并设置图片的像素大小)

目前画的图如下:
10

希望将下图“全部完成”替换“绿色的9个不同位置的点”,像素设置为532 × 140,并覆盖在其他蓝色点上(可以覆盖一部分)
长条按钮480

code

(以下代码只给出了绿色点)

import matplotlib.pyplot as plt

xpos = [-300, -300, -300, 0, 0, 0, 300, 300, 300]
ypos = [-533, 0, 533, -533, 0, 533, -533, 0, 533]

fig,ax = plt.subplots(figsize=(6,8))# 设置图大小
ax.set_ylim(800,-800) # 设置坐标轴
ax.set_xlim(-600,600)

# ax.scatter(x, y, marker='o', color='blue', alpha=0.3, edgecolor='black') 蓝色点就先不传数据啦
ax.scatter(xpos, ypos, marker='o', color='green')
plt.title('hotzone scatter plot ')

长条按钮480

from PIL import Image
im_path = '长条按钮480.png'
target = Image.open(im_path)
target

@hupili Could you please help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions