The following is a snippet of a code in which I used position=(float, float) in set_title to put the title inside the plot axes and to the upper left corner. It worked until today. Now, it doesn't take into account the position Text property and always puts the title outside the plot axes, though still at the upper left corner.

fig,a =  plt.subplots(4,2,figsize=(6.5, 9), dpi=600)
a[0][0].plot(A[:,0],A[:,1], lw=0.75, c='blue')
a[0][0].set_title('Aluminium 1', fontsize=8, position=(0.2, 0.825))
a[0][0].tick_params(axis='both', which='major', direction='out', length=2.5, width=1, labelsize=6)
a[0][0].set_xlabel("Frequency (THz)", fontsize=5, verticalalignment='center_baseline')
a[0][0].set_ylabel("Partial DoS", fontsize=5)

The output from when it worked: enter image description here

The output now: enter image description here

Any idea why this behaviour shift? Also, any suggestion for a better way to make inside titles is welcome.

  • 2
    \$\begingroup\$ I'm voting to close this question since it's off-topic. On this site, we review working code. Please read How to Ask. Find more information in the help center \$\endgroup\$ – Aryan Parekh Nov 17 at 16:39
  • \$\begingroup\$ Hello @AryanParekh, I was doubtful about asking this question but thought it was alright since I also ask for better ways to make the title which seems to fir this site's purview. \$\endgroup\$ – Hitanshu Sachania Nov 17 at 16:46
  • 1
    \$\begingroup\$ Code not working as expected is off-topic on this site, once you have fully working code that you want to get reviewed feel free to post it here. \$\endgroup\$ – Aryan Parekh Nov 17 at 16:47
  • \$\begingroup\$ Alright, is it okay if the question is closed for only a while? I'll edit it once I solve the set_title issue. \$\endgroup\$ – Hitanshu Sachania Nov 17 at 16:53
  • 1
    \$\begingroup\$ Not a problem, but make sure you read this before you continue :) \$\endgroup\$ – Aryan Parekh Nov 17 at 16:55