Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scatter3D 生成png和pdf失败 #52

Open
februaryfang opened this issue Dec 29, 2022 · 0 comments
Open

Scatter3D 生成png和pdf失败 #52

februaryfang opened this issue Dec 29, 2022 · 0 comments

Comments

@februaryfang
Copy link

你好,

输入数据为data_scatter:
[('TRBV10-3', 'TRBD1', 'TRBJ1-1', 1, 1), ('TRBV10-3', 'TRBD1', 'TRBJ1-5', 1, 9), ('TRBV10-3', 'TRBD1', 'TRBJ2-7', 1, 2), ('TRBV11-2', 'TRBD1', 'TRBJ1-3', 1, 5), ('TRBV11-2', 'TRBD1', 'TRBJ1-4', 1, 6), ('TRBV12-3', 'TRBD1', 'TRBJ2-1', 1, 7), ('TRBV12-4', 'TRBD2', 'TRBJ2-1', 1, 3), ('TRBV13', 'TRBD1', 'TRBJ2-3', 3, 45), ('TRBV15', 'TRBD1', 'TRBJ1-4', 2, 4), ('TRBV18', 'TRBD1', 'TRBJ1-5', 1, 12), ('TRBV18', 'TRBD1', 'TRBJ2-4', 1, 6), ('TRBV2', 'TRBD1', 'TRBJ1-4', 1, 3), ('TRBV2', 'TRBD1', 'TRBJ2-5', 1, 5), ('TRBV20-1', 'TRBD1', 'TRBJ1-4', 1, 10), ('TRBV20-1', 'TRBD1', 'TRBJ2-2', 1, 5), ('TRBV20-1', 'TRBD1', 'TRBJ2-3', 1, 11), ('TRBV25-1', 'TRBD1', 'TRBJ1-2', 1, 3), ('TRBV29-1', 'TRBD1', 'TRBJ2-5', 3, 21), ('TRBV5-1', 'TRBD1', 'TRBJ1-2', 1, 10), ('TRBV5-1', 'TRBD1', 'TRBJ2-1', 1, 4), ('TRBV5-1', 'TRBD1', 'TRBJ2-4', 1, 7), ('TRBV5-4', 'TRBD1', 'TRBJ1-4', 1, 3), ('TRBV5-4', 'TRBD1', 'TRBJ2-7', 1, 12), ('TRBV5-5', 'TRBD1', 'TRBJ2-1', 1, 7), ('TRBV5-6', 'TRBD2', 'TRBJ2-1', 1, 2), ('TRBV6-1', 'TRBD2', 'TRBJ2-7', 1, 5), ('TRBV6-5', 'TRBD1', 'TRBJ1-1', 1, 1), ('TRBV6-5', 'TRBD1', 'TRBJ1-3', 1, 9), ('TRBV6-5', 'TRBD1', 'TRBJ2-2', 1, 16), ('TRBV6-5', 'TRBD1', 'TRBJ2-7', 1, 7), ('TRBV6-6', 'TRBD1','TRBJ1-5', 1, 3), ('TRBV6-6', 'TRBD1', 'TRBJ1-6', 1, 8), ('TRBV6-6', 'TRBD2', 'TRBJ2-7', 1, 5), ('TRBV6-9', 'TRBD1', 'TRBJ1-4', 1, 5), ('TRBV7-2', 'TRBD1', 'TRBJ1-2', 1, 7), ('TRBV7-2', 'TRBD1', 'TRBJ2-5', 1, 5), ('TRBV7-8', 'TRBD1', 'TRBJ1-2', 1, 2), ('TRBV7-8', 'TRBD1', 'TRBJ2-1', 1, 6), ('TRBV7-8', 'TRBD1', 'TRBJ2-6', 1, 13), ('TRBV9', 'TRBD2', 'TRBJ2-1', 2, 8)]

画图代码为:
file_path="{}/".format(os.path.dirname(os.path.abspath("./echarts.min.js")))
def scatter3d() -> Scatter3D:
c = (
Scatter3D(init_opts = opts.InitOpts(width='900px',height='700px', js_host=file_path))
.add("",
data_scatter,
xaxis3d_opts=opts.Axis3DOpts(
name="v-gene",
type_="category",
),
yaxis3d_opts=opts.Axis3DOpts(
name="d-gene",
type_="category",
),
zaxis3d_opts=opts.Axis3DOpts(
name="j-gene",
type_="category",
),
grid3d_opts = opts.Grid3DOpts(width=100, depth=90, rotate_speed = 90, is_rotate=False)
)
.set_global_opts(title_opts=opts.TitleOpts(title="Scatter3D of VDJ-pairs"),
visualmap_opts=[
opts.VisualMapOpts(type_="color", dimension=4, pos_top="40", max_= max(data_filter['umis'].tolist())),
opts.VisualMapOpts(type_="size", dimension=3, pos_bottom="40", max_= max(data_filter['barcodes'].tolist()), range_size=[1, max(data_filter['barcodes'].tolist())*5],
),
]
)
)
return c

scatter3d_png = os.path.join(od_path, "Scatter3D_vdj_pairs.png")
make_snapshot(snapshot, scatter3d().render(), scatter3d_png)
生成的PNG是空的。

我把echarts.min.js下载到linux,Sankey图按照这个模式是可以生成PNG 和PDF的,但是Scatter3D不知道为什么不行

盼复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant