Skip to content

Creating nice overlay outputs #1803

Answered by rijobro
ghost asked this question in Q&A
Mar 18, 2021 · 1 comments · 3 replies

You must be logged in to vote

You can set the alpha (opacity) on a voxel-by-voxel basis. Normally, you would probably create another array, with the same shape as contour with alpha values between 0 and 1. However, in your case, contour already contains the correct alphas! (Because you want alpha=1 where contour=1 and 0 elsewhere.)

fig, ax = plt.subplots()
ax.imshow(im, cmap="gray")
ax.imshow(contour, alpha=contour)

ax.set_axis_off()
plt.show()

Replies: 1 comment 3 replies

You must be logged in to vote
3 replies
@rijobro

rijobro Mar 18, 2021
Collaborator

@ghost

@Meddebma

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants