Issue
I want to add a logo in my figure. So im using this code:
for code, data in normals.groupby('CODE'):
fig, (ax1, ax2, ax3, ax4) = plt.subplots(4, sharex=False, sharey=False,figsize=(20, 15))
data.plot('MONTH',["TMAX"], alpha=0.5, color='red', marker='P', fontsize = 15.0,ax=ax1)
data.plot('MONTH',["TMIN"], alpha=0.5,color='blue',marker='D', fontsize = 15.0,ax=ax2)
data.plot('MONTH',["PP"],kind='bar',color='green', fontsize = 15.0,ax=ax3)
table=ax4.table(cellText=data[['TMAX','TMIN','PP']].T.values,colLabels=["January","February","March","April","May","June","July","August",
"September","October","November","December"],
rowLabels=data[['TMAX','TMIN','PP']].columns,rowColours =["blue"] * 3,
colColours =["blue"] * 12,loc="center",bbox = [0.0, -0.5, 1, 1])
logo = plt.imread('path/to/image/logo.jpg')
plt.figimage(logo,origin='upper')
But the issue is that i don't know how to resize the logo proportionaly to the figure fig
. Also i have a loop so maybe is harder to do.
Would you mind to help me please?
Thanks in advance.
Solution
Do something like:
# adjust the numbers below to taste:
ax_logo = fig.add_axes([0.01, 0.01, 0.08, 0.08])
ax_logo.imshow(logo)
ax_logo.axis('off')
Answered By - Jody Klymak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.