J'essaie d'utiliser Matplotlib en Python pour afficher une image et afficher le texte en divers points sur elle. Je voudrais rendre l'image partiellement transparente, afin d'augmenter la visibilité du texte.Définir la couleur d'arrière-plan derrière l'image dans matplotlib
Cependant, je veux la couleur de fond derrière l'image d'être blanc au lieu de gris et je ne peux pas comprendre comment obtenir ce changement de bâton. C'est là que je suis.
img = plt.imread("counties.png")
fig, ax = plt.subplots()
plt.axis('off')
plt.text(.6, .68,'matplotlib', ha='center', va='center',
transform=ax.transAxes, color=(0,.16,.48), fontname='Kanit Light')
plt.text(.5, .5,'test', ha='center', va='center', transform=ax.transAxes,
color=(0,.16,.48))
ax.imshow(img, alpha=0.05)
plt.show()
Afficher l'image counties.png. – Serenity